更改安装过程中的快捷方式索引

时间:2022-11-05 22:45:53

I'm working with InstallShield 2013 Professional, Basic MSI Project.

我正在使用InstallShield 2013 Professional,Basic MSI Project。

My installation package contains exe file - myfile.exe. I added shortcut for it in Shortcuts view specifying myfile.exe as Icon File, and 0 as Icon Index. The destination place for this shortcut is a Desktop on a target box.

我的安装包包含exe文件 - myfile.exe。我在快捷方式视图中添加了快捷方式,将myfile.exe指定为图标文件,将0指定为图标索引。此快捷方式的目标位置是目标框上的桌面。

Suppose, my executable contains 3 icon resources and I want to change icon dynamically during Installation. To be more clear what I want to do: I have 3 radio buttons on one of Installation Dialogs and I want to apply icon to myfile.exe shortcut depending on radio button that was checked (1-st radio button->1-st icon, 2-nd radio button->2-nd icon, 3-rd radio button->3-rd icon).

假设,我的可执行文件包含3个图标资源,我想在安装过程中动态更改图标。为了更清楚我想做什么:我在其中一个安装对话框上有3个单选按钮,我想根据选中的单选按钮将图标应用到myfile.exe快捷方式(1-st单选按钮 - > 1-st图标,第二个单选按钮 - >第二个图标,第三个单选按钮 - >第三个图标)。

How can I get this behavior? In other words, how can I change icon index of Icon File during installation?

我怎么能得到这种行为?换句话说,如何在安装过程中更改Icon File的图标索引?

1 个解决方案

#1


1  

This is kind of a complicated request. An easier way of achieving this would be to compile the EXE three times with different names and different icon 0 resources and then use mutually exclusive component conditions to control which one gets installed.

这是一个复杂的要求。实现这一目标的一种更简单的方法是使用不同的名称和不同的图标0资源编译EXE三次,然后使用互斥的组件条件来控制安装哪一个。

It gets trickier if that's not an option. The Shortcut Table defines the IconIndex column as an integer and is not formattable. This means you can't say [ICONINDEX] in the field and let it resolve at install time.

如果那不是一个选择,它会变得更加棘手。快捷方式表将IconIndex列定义为整数,并且不是可格式化的。这意味着你不能在字段中说[ICONINDEX]并让它在安装时解析。

So what can you do? You can use a custom action to dynamically emit table data into temp tables during the install. An example using C# can be found here at: Dynamic Windows Installer UI

所以,你可以做什么?您可以使用自定义操作在安装期间将表数据动态地发布到临时表中。可以在以下位置找到使用C#的示例:Dynamic Windows Installer UI

Realize that if someone creates a shortcut by hand they are likely to pick the "wrong" icon.

意识到如果有人手动创建快捷方式,他们可能会选择“错误”图标。

#1


1  

This is kind of a complicated request. An easier way of achieving this would be to compile the EXE three times with different names and different icon 0 resources and then use mutually exclusive component conditions to control which one gets installed.

这是一个复杂的要求。实现这一目标的一种更简单的方法是使用不同的名称和不同的图标0资源编译EXE三次,然后使用互斥的组件条件来控制安装哪一个。

It gets trickier if that's not an option. The Shortcut Table defines the IconIndex column as an integer and is not formattable. This means you can't say [ICONINDEX] in the field and let it resolve at install time.

如果那不是一个选择,它会变得更加棘手。快捷方式表将IconIndex列定义为整数,并且不是可格式化的。这意味着你不能在字段中说[ICONINDEX]并让它在安装时解析。

So what can you do? You can use a custom action to dynamically emit table data into temp tables during the install. An example using C# can be found here at: Dynamic Windows Installer UI

所以,你可以做什么?您可以使用自定义操作在安装期间将表数据动态地发布到临时表中。可以在以下位置找到使用C#的示例:Dynamic Windows Installer UI

Realize that if someone creates a shortcut by hand they are likely to pick the "wrong" icon.

意识到如果有人手动创建快捷方式,他们可能会选择“错误”图标。