I create a shortcut with following codes.
var MyObject : IUnknown;
var MySLink : IShellLink;
var MyPFile : IPersistFile;
MyObject := CreateComObject(CLSID_ShellLink);
MySLink := MyObject as IShellLink;
MyPFile := MyObject as IPersistFile;
with MySLink do
begin
SetPath(PChar(sExePath + sExeName));
SetArguments(PChar (sParams));
SetWorkingDirectory(PChar(sExePath));
end;
MyPFile.Save(PWChar(WideString(GetDesktopFolder + '\MyApp.lnk')), False);
But I want to change the shortcut icon.
For example, I make a shortcut for NOTEPAD.EXE on my DESKTOP. so How can I change its ICON. When you RIGHT click on the shortcut, choose properties, then you can see a button named "CHANGE ICON", that's it what I want.
How can I do that with code ?
Thanks @Jonahatan
Links IShellLinkW::SetIconLocation method
Code Sample
with MySLink do
begin
SetPath(PChar(sExePath + sExeName));
SetArguments(PChar (sParams));
SetWorkingDirectory(PChar(sExePath));
SetIconLocation(PWideChar(sNewIconFileName),0);
end;