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.