gpt4 book ai didi

windows - 将文件类型/扩展名与 Inno Setup 中的 .exe 文件中的非主要图标相关联

转载 作者:行者123 更新时间:2023-12-04 15:04:30 29 4
gpt4 key购买 nike

我试图让 Inno Setup 将三种文件类型与我的应用程序相关联,并为每个嵌入在我的应用程序中的文件类型分配一个图标。
我现在已经编辑了这个问题,以反射(reflect)建议的最新方法。
我在主应用程序中添加了两个图标,主应用程序图标和用于我的 Delphi 应用程序使用的文件类型的 Icon_1 和 Icon_2。我使用了项目菜单下的资源和图像对话框来添加它们。我为此使用的脚本如下。

[Registry]
; Create the application capability key
Root: HKLM; Subkey: "Software\{#MyAppPublisher}"; Flags: uninsdeletekeyifempty
Root: HKLM; Subkey: "Software\{#MyAppPublisher}\{#MyAppName}"; Flags: uninsdeletekeyifempty
Root: HKLM; Subkey: "Software\{#MyAppPublisher}\{#MyAppName}\Capability"; ValueType: string; ValueName: "ApplicationDescription"; ValueData: "Integrated Development Environment for Positron Compilers"; Flags: uninsdeletevalue
Root: HKLM; Subkey: "Software\{#MyAppPublisher}\{#MyAppName}\Capability"; ValueType: string; ValueName: "ApplicationName"; ValueData: "{#MyAppName}"; Flags: uninsdeletevalue

; List of extensions the application supports
Root: HKLM; Subkey: "Software\{#MyAppPublisher}\{#MyAppName}\Capability\FileAssociations"; ValueType: string; ValueName: ".bas"; ValueData: "{#MyAppName}.bas"; Flags: uninsdeletevalue
Root: HKLM; Subkey: "Software\{#MyAppPublisher}\{#MyAppName}\Capability\FileAssociations"; ValueType: string; ValueName: ".inc"; ValueData: "{#MyAppName}.inc"; Flags: uninsdeletevalue
Root: HKLM; Subkey: "Software\{#MyAppPublisher}\{#MyAppName}\Capability\FileAssociations"; ValueType: string; ValueName: ".psproj"; ValueData: "{#MyAppName}.psproj"; Flags: uninsdeletevalue

; Add the capability key to list of registered applications
Root: HKLM; Subkey: "Software\RegisteredApplications"; ValueType: string; ValueName: "{#MyAppName}"; ValueData: "Software\#MyAppPublisher}\{#MyAppName}\Capability"; Flags: uninsdeletevalue

; For each extension that the application supports
Root: HKCR; Subkey: "{#MyAppName}.bas"; Flags: uninsdeletekeyifempty
Root: HKCR; Subkey: "{#MyAppName}.bas"; ValueType: string; ValueName: ""; ValueData: "{#MyAppName} bas"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "{#MyAppName}.bas\DefaultIcon"; Flags: uninsdeletekeyifempty
Root: HKCR; Subkey: "{#MyAppName}.bas\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},1"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "{#MyAppName}.bas\Shell"; Flags: uninsdeletekeyifempty
Root: HKCR; Subkey: "{#MyAppName}.bas\Shell\open"; Flags: uninsdeletekeyifempty
Root: HKCR; Subkey: "{#MyAppName}.bas\Shell\open\Command"; Flags: uninsdeletekeyifempty
Root: HKCR; Subkey: "{#MyAppName}.bas\Shell\open\Command"; ValueType: string; ValueName: ""; ValueData: """{app}{#MyAppExeName}"" ""1"""; Flags: uninsdeletevalue

Root: HKCR; Subkey: "{#MyAppName}.inc"; Flags: uninsdeletekeyifempty
Root: HKCR; Subkey: "{#MyAppName}.inc"; ValueType: string; ValueName: ""; ValueData: "{#MyAppName} inc"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "{#MyAppName}.inc\DefaultIcon"; Flags: uninsdeletekeyifempty
Root: HKCR; Subkey: "{#MyAppName}.inc\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},1"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "{#MyAppName}.inc\Shell"; Flags: uninsdeletekeyifempty
Root: HKCR; Subkey: "{#MyAppName}.inc\Shell\open"; Flags: uninsdeletekeyifempty
Root: HKCR; Subkey: "{#MyAppName}.inc\Shell\open\Command"; Flags: uninsdeletekeyifempty
Root: HKCR; Subkey: "{#MyAppName}.inc\Shell\open\Command"; ValueType: string; ValueName: ""; ValueData: """{app}{#MyAppExeName}"" ""1"""; Flags: uninsdeletevalue

Root: HKCR; Subkey: "{#MyAppName}.psproj"; Flags: uninsdeletekeyifempty
Root: HKCR; Subkey: "{#MyAppName}.psproj"; ValueType: string; ValueName: ""; ValueData: "{#MyAppName} psproj"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "{#MyAppName}.psproj\DefaultIcon"; Flags: uninsdeletekeyifempty
Root: HKCR; Subkey: "{#MyAppName}.psproj\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},1"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "{#MyAppName}.psproj\Shell"; Flags: uninsdeletekeyifempty
Root: HKCR; Subkey: "{#MyAppName}.psproj\Shell\open"; Flags: uninsdeletekeyifempty
Root: HKCR; Subkey: "{#MyAppName}.psproj\Shell\open\Command"; Flags: uninsdeletekeyifempty
Root: HKCR; Subkey: "{#MyAppName}.psproj\Shell\open\Command"; ValueType: string; ValueName: ""; ValueData: """{app}{#MyAppExeName}"" ""1"""; Flags: uninsdeletevalue
现在这些关联似乎已经丢失了。我知道文件中有两个图标,因为当我创建快捷方式时,我可以从任一图标中进行选择。我需要做什么才能在我的文件上获得正确的图标?
在注册表中 HKEY_CLASSES_ROOT.bas我有:
DefaultIcon - not set
ProgWithIDs - not set
PersitentHandler - {5e941d80-bf96-11cd-b579-08002b30bfeb}

最佳答案

您必须更换 %1使用 .exe 文件中图标组的基于 0 的索引。

Root: HKCU; Subkey: "Software\Classes\.bas\DefaultIcon"; ValueName: ""; \
ValueType: string; ValueData: "{app}\{#MyAppExeName},ICON_GROUP_INDEX_GOES_HERE"; \
Flags: uninsdeletevalue;
https://docs.microsoft.com/en-us/windows/win32/shell/how-to-assign-a-custom-icon-to-a-file-type

例如,这将设置 .isstest图标到 Inno Setup 的文档图标( Compil32.exe 中的第二个图标):
[Registry]
Root: HKCU ; Subkey: "Software\Classes\.isstest"; ValueData: "Icon Test"; \
ValueType: string; ValueName: ""; Flags: uninsdeletevalue;
Root: HKCU ; Subkey: "Software\Classes\.isstest\DefaultIcon"; ValueType: string; \
ValueData: "C:\Program Files (x86)\Inno Setup 6\Compil32.exe,1"; ValueName: ""; \
Flags: uninsdeletevalue;
enter image description here
enter image description here

虽然这种文件关联方法已经过时。有关最新方法,请参阅 Inno Setup: Extending Windows default apps list .另一方面,您的图标问题与此无关。在新方法中,您以相同的方式指定图标,因此您将遇到相同的问题。

关于windows - 将文件类型/扩展名与 Inno Setup 中的 .exe 文件中的非主要图标相关联,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66412135/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com