[SOLVED] Shortcut lnk with icon lazarus / 34-Windows ---------------------------------------------------------------------- pcurtis · 2022-03-23 16:58 I can create a shortcut with the following Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.BCButton1Click(Sender: TObject);  var     IObject : IUnknown;   ISLink : IShellLink;     IPFile : IPersistFile;     PIDL : PItemIDList;     InFolder : array[0..MAX_PATH] of Char;     TargetName : String;     LinkName : WideString;     AppDataPath: Array[0..MaxPathLen] of Char; //Allocate memory     begin        TargetName := 'c:\windows\notepad.exe';        IObject := CreateComObject(CLSID_ShellLink) ;        ISLink := IObject as IShellLink;        IPFile := IObject as IPersistFile;        with ISLink do        begin          SetPath(pChar(TargetName)) ;          SetWorkingDirectory(pChar(ExtractFilePath(TargetName))) ;          //to store the path          AppDataPath:='';          SHGetSpecialFolderPath(0,AppDataPath,CSIDL_DESKTOPDIRECTORY,false);        LinkName := AppDataPath + '\Delphi Created Link.lnk';          //to create the shortcut          IPFile.Save(PWChar(LinkName), false) ;        end;end;  How can I specify a custom icon? ---------------------------------------------------------------------- sstvmaster · 2022-03-23 20:48 I think like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SetIconLocation(PChar('%SystemRoot%\System32\SHELL32.dll'), 12); 12 is a example or use any ico maybe png file? Quote from: pcurtis on March 23, 2022, 05:58:26 pmI can create a shortcut with the following Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i         ...        with ISLink do        begin          SetPath(pChar(TargetName)) ;          SetWorkingDirectory(pChar(ExtractFilePath(TargetName))) ;          SetIconLocation(PChar('%SystemRoot%\System32\SHELL32.dll'), 12); // <-- 12 is a example or use any ico maybe png file?          ...  How can I specify a custom icon? ---------------------------------------------------------------------- pcurtis · 2022-03-24 03:24 Thanks