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

Function CreateShortcut

source/main.cpp:865–898  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

863}
864//---------------------------------------------------------------------------
865void __fastcall CreateShortcut(int where)
866{
867 TWaitCursor wait;
868 String ShortcuteName = Application->Title;
869 String ShortcutFileName;
870
871 try
872 {
873 char szLinkPath[MN];
874 HRESULT hr = SHGetFolderPath(NULL, where, NULL, 0, szLinkPath);
875 if( FAILED(hr) )
876 throw Exception(FormatLastError2(hr) + " [1:" + IntToStr(hr) + "]");
877
878 ShortcutFileName = String(szLinkPath) + "\\" + ShortcuteName + ".lnk";
879
880 hr = CreateLink(ApplicationExeName.c_str(),
881 "",
882 ShortcutFileName.c_str(),
883 "",
884 "tray");
885 if( FAILED(hr) )
886 throw Exception(FormatLastError2(hr) + " [2:" + IntToStr(hr) + "]");
887 }
888 catch(const Exception & E)
889 {
890 ReportError2("Error creating shortcut \"%s\"\nApplication \"%s\"\nError: \"%s\"",
891 ShortcutFileName.c_str(), ApplicationExeName.c_str(), E.Message.c_str());
892 }
893 catch(...)
894 {
895 ReportError2("Error creating shortcut \"%s\"\nApplication \"%s\"",
896 ShortcutFileName.c_str(), ApplicationExeName.c_str());
897 }
898}
899//---------------------------------------------------------------------------
900void __fastcall DeleteShortcut(int where)
901{

Callers 1

aSetupExecuteMethod · 0.85

Calls 3

FormatLastError2Function · 0.85
CreateLinkFunction · 0.85
ReportError2Function · 0.85

Tested by

no test coverage detected