0

I wish to add a custom Desktop icon to my executable in Inno Setup.

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; 

[Files]
Source: C:\icons\javelin.ico; DestDir: {app}; Flags: dontcopy;

[Icons]
Name: "{userdesktop}\{#MyAppName}"; Filename: "{code:GetDir}\source\app\{#MyAppExeName}"; Tasks: desktopicon; IconFilename: "{tmp}\javelin.ico";


function InitializeSetup(): Boolean;
begin
   ExtractTemporaryFile('javelin.ico');
Result := True;
end;

The above code is adding the icon on desktop but when the user restarts the machine the javelin image will disappears only file's default icon will remain.

Trang D
  • 333
  • 5
  • 16
  • 1
    Doesn't your application has the icon built-in? – See also [How to create a desktop icon with Inno Setup](https://stackoverflow.com/q/32262254/850848). – Martin Prikryl Jun 10 '20 at 07:50

1 Answers1

1

It is because you use Temp Folder for your icon. if you want your icon path to be available all the time you should use some permanent path. for example copy it to {app} folder or some other path.