Pergunta

I'm trying to add second .ico file to use it as icon for files, associated with my application. Piece of code:

[Registry]
Root: HKCR; Subkey: ".tc65"; ValueType: string; ValueName: ""; ValueData: {#DispatcherName};   Flags: uninsdeletevalue;
Root: HKCR; Subkey: {#DispatcherName}; ValueType: string; ValueName: ""; ValueData: {#MyAppName}; Flags: uninsdeletekey;
Root: HKCR; Subkey: "{#DispatcherName}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},1" 
Root: HKCR; Subkey: "{#DispatcherName}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1""" 

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

As I understood, this line

Root: HKCR; Subkey: "{#DispatcherName}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},1"

says to use second icon for associated files. How to create this icon with known path? Tried several variants in [Icons] section, but without success.

Maybe I should add an icon to exe before compiling it?

Foi útil?

Solução

The [Icons] section is for creating shortcuts. It has no relationship to file associations whatsoever.

In order to set the icon to use for an association, you need to set the DefaultIcon key to the path to the icon. This can either be a loose .ico file installed via a [Files] entry or (preferred) an icon resource compiled into your executable file.

The value you have in your question will tell Windows to use the second icon resource compiled into your executable.

Don't forget to also enable the ChangesAssociations setting.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top