icons - 使用 inno setup 卸载默认图标

标签 icons inno-setup uninstallation

我正在使用 Inno 安装程序将卸载图标添加到开始菜单文件夹。

使用 Inno 设置脚本向导(例如我的程序),有一个默认卸载图标 enter image description here

这是示例代码。

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyProg.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{9BBC9685-FB4E-4BF1-B2B4-07A46B467911}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

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

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

我希望在我的软件中使用相同的卸载默认图标,以避免从互联网下载图标或创建我自己的图标。

我的 inno 设置软件的代码如下。使用此代码,卸载图标与 .exe 的图标相同。
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Remove xyz-duplicate LiDAR points"
#define MyAppVersion "0.2 Beta"
#define MyAppExeName "remove_duplicate_xyz_executable_project.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{73F937B9-0CD9-44F1-B07E-17CD2399EE13}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
OutputBaseFilename=Remove xyz-duplicate LiDAR points
SetupIconFile=C:\PythonScript\Script_fun\Remove_duplicate_xyz\LiDAR_Remove_xyz_Duplicate_Point_executable_project\iconRemoveduplicate_two_80res_small.ico
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
Name: "norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Remove_duplicate_xyz\LiDAR_Remove_xyz_Duplicate_Point_executable_project\dist\_ctypes.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Remove_duplicate_xyz\LiDAR_Remove_xyz_Duplicate_Point_executable_project\dist\_hashlib.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Remove_duplicate_xyz\LiDAR_Remove_xyz_Duplicate_Point_executable_project\dist\_socket.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Remove_duplicate_xyz\LiDAR_Remove_xyz_Duplicate_Point_executable_project\dist\_ssl.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Remove_duplicate_xyz\LiDAR_Remove_xyz_Duplicate_Point_executable_project\dist\bz2.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Remove_duplicate_xyz\LiDAR_Remove_xyz_Duplicate_Point_executable_project\dist\library.zip"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Remove_duplicate_xyz\LiDAR_Remove_xyz_Duplicate_Point_executable_project\dist\python27.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Remove_duplicate_xyz\LiDAR_Remove_xyz_Duplicate_Point_executable_project\dist\remove_duplicate_xyz_executable_project.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Remove_duplicate_xyz\LiDAR_Remove_xyz_Duplicate_Point_executable_project\dist\select.pyd"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\PythonScript\Script_fun\Remove_duplicate_xyz\LiDAR_Remove_xyz_Duplicate_Point_executable_project\dist\unicodedata.pyd"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

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

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

最佳答案

如果设置 SetupIconFile那么卸载 Exe 文件(例如 unins000.exe)将实现完全相同的图标。覆盖此图标显示的一种方法是设置自定义 UninstallDisplayIcon[Setup]控制面板添加/删除列表和 IconFileName 部分在 [Icons]放置在桌面、开始菜单等上的快捷方式部分。在这两种情况下,您都必须拥有必须与您的应用程序一起安装的自定义图标文件。

[Setup]
SetupIconFile=C:\mysourcedir\mysetup.ico
UninstallDisplayIcon={app}\myuninstall.ico 
                        //overrides icon on Add/Remove List in Control Panel

[Files]
Source: "C:\mysourcedir\myuninstall.ico"; DestDir: "{app}"

[Icons]
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}";
 IconFilename: "{app}\myuninstall.ico" 
                       //overrides icon in Start Menu shortcut

第二个是预编译 unins000.exe 并实现特定图标。虽然在某些情况下可能会很棘手(使用 unins001、unins002 等进行多次安装;自定义代码功能)

关于icons - 使用 inno setup 卸载默认图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15845226/

相关文章:

batch-file - 将自定义 CLI 参数传递给 Inno Setup 卸载程序

java - 将 Icon 设置为 JApplet 标题栏

android - 抽屉导航右下角图标android

html - 具有数据属性值作为 CSS 内容的通知徽章

unicode - LoadStringFromFile 和 StringChangeEx 来自 Unicode Inno Setup(Ansi 文件)

installation - 仅当用户选择时才使用 Inno Setup 下载文件

web-config - DNN 模块卸载如何从 web.config 中删除设置

android - 想对我的应用程序进行卸载 :android

windows - 在哪里可以找到 Windows 7 UX 指南中推荐的图标/动画?

inno-setup - 为什么需要管理员权限?