---------------------------------------------------------------------------
| 898 | } |
| 899 | //--------------------------------------------------------------------------- |
| 900 | void __fastcall DeleteShortcut(int where) |
| 901 | { |
| 902 | String ShortcuteName = Application->Title; |
| 903 | String ShortcutFileName; |
| 904 | |
| 905 | try |
| 906 | { |
| 907 | char szLinkPath[MN]; |
| 908 | HRESULT hr = SHGetFolderPath(NULL, where, NULL, 0, szLinkPath); |
| 909 | if( FAILED(hr) ) |
| 910 | throw Exception(FormatLastError2(hr) + " [1:" + IntToStr(hr) + "]"); |
| 911 | |
| 912 | ShortcutFileName = String(szLinkPath) + "\\" + ShortcuteName + ".lnk"; |
| 913 | |
| 914 | if( ! ::DeleteFile(ShortcutFileName.c_str()) ) |
| 915 | { |
| 916 | hr = GetLastError(); |
| 917 | throw Exception(FormatLastError2(hr) + " [2:" + IntToStr(hr) + "]"); |
| 918 | } |
| 919 | } |
| 920 | catch(const Exception & E) |
| 921 | { |
| 922 | ReportError2("Failed to delete a shortcut \"%s\"\nError: \"%s\"", |
| 923 | ShortcutFileName.c_str(), E.Message.c_str()); |
| 924 | } |
| 925 | catch(...) |
| 926 | { |
| 927 | ReportError2("Failed to delete a shortcut \"%s\"", |
| 928 | ShortcutFileName.c_str()); |
| 929 | } |
| 930 | } |
| 931 | //--------------------------------------------------------------------------- |
| 932 | bool __fastcall IsShortcutExist(int where) |
| 933 | { |
no test coverage detected