简体   繁体   English

如何在Inno Setup中引用文件关联的自定义图标?

[英]How can I reference a custom icon for a file association in Inno Setup?

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. 在OS X上,有一种通过Info.plist做到这一点的明确方法。 In Windows, however, I'm having trouble. 但是,在Windows中,我遇到了麻烦。 I am using Launch4J and Inno Setup. 我正在使用Launch4J和Inno安装程序。

Inno Setup describes how to specify an icon via a file association . Inno Setup 描述了如何通过文件关联指定图标 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. 该示例使用的应用程序EXE包含多个图标,将它们引用为0、1、2等。但是,Launch4J似乎仅支持使用单个图标(应用程序图标)创建EXE。 So this example won't work for me. 所以这个例子对我不起作用。

Here is my current Icons section: 这是我当前的Icons部分:

[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? 如何在Inno Setup中引用文件关联的自定义图标? (Or embed multiple icons in a Launch4J EXE?) (或在Launch4J EXE中嵌入多个图标?)

You can point any icon file or choose an icon from EXE/DLL file: 您可以指向任何图标文件,或从EXE / DLL文件中选择一个图标:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM