MCPcopy Create free account
hub / github.com/MaxBelkov/visualsyslog / DeleteShortcut

Function DeleteShortcut

source/main.cpp:900–930  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

898}
899//---------------------------------------------------------------------------
900void __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//---------------------------------------------------------------------------
932bool __fastcall IsShortcutExist(int where)
933{

Callers 1

aSetupExecuteMethod · 0.85

Calls 2

FormatLastError2Function · 0.85
ReportError2Function · 0.85

Tested by

no test coverage detected