4

My application creates documents. I want to have a special icon for the documents it creates, other than just the application icon. On OS X, there is a clear way to do this via the Info.plist. In Windows, however, I'm having trouble. I am using Launch4J and Inno Setup.

Inno Setup describes how to specify an icon via a file association. The example uses the application EXE that contains multiple icons, referencing them as 0, 1, 2, etc. However, Launch4J appears to only support creating an EXE with a single icon, the application icon. So this example won't work for me.

Here is my current Icons section:

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon

Here is an example file association:

[Registry]
Root: HKCR; Subkey: ".ext"; ValueType: string; ValueName: ""; ValueData: "EXT"; Flags: uninsdeletevalue; Tasks: associateext
Root: HKCR; Subkey: "EXT"; ValueType: string; ValueName: ""; ValueData: "EXT"; Flags: uninsdeletekey; Tasks: associateext
Root: HKCR; Subkey: "EXT\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\MyProg.exe,0"; Tasks: associateext
Root: HKCR; Subkey: "EXT\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\MyProg.exe"" ""%1"""; Tasks: associateext

How can I reference a custom icon for a file association in Inno Setup? (Or embed multiple icons in a Launch4J EXE?)

martinez314
  • 12,162
  • 5
  • 36
  • 63
  • As [`the reference`](http://msdn.microsoft.com/en-us/library/windows/desktop/hh127427(v=vs.85).aspx) mentions, the `DefaultIcon` subkey value specifies the fully qualified path for any file that contains an icon, including *.ico, *.exe, and *.dll files. Also, don't forget to set `ChangesAssociations` directive to `yes` as your linked example suggests. – TLama May 30 '14 at 16:36

1 Answers1

2

You can point any icon file or choose an icon from EXE/DLL file:

Root: "HKCR"; Subkey: "EXT\DefaultIcon"; ValueType: string; 
 ValueData: """PATH\Icon.file"""; Flags: uninsdeletekey; Tasks: associateext

In your case it could be:

Root: "HKCR"; Subkey: "EXT\DefaultIcon"; ValueType: string; 
 ValueData: """{app}\MyCustomIcon.ico"""; Flags: uninsdeletekey; Tasks: associateext
RobeN
  • 5,346
  • 1
  • 33
  • 50
  • I guess that's all there was to it. Thanks. I assumed you needed a new line in the Icon section. I just copied the ICO resource to my application folder and referenced it as: `{app}\myprog_doc.ico` – martinez314 May 30 '14 at 16:44