inno setup win10 创建菜单里面卸载图标

1、win10自己注册表关联的卸载图标 会隐藏 卸载图标。现在的项目法是 不写注册表 直接 在目标文件里面创建快捷方式 移动到菜单里面


; 脚本由 Inno Setup 脚本向导 生成!
; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档!

#define MyAppName ""
#define Close "卸载"
#define MyAppVersion "1.0"
#define MyAppPublisher ""
#define MyAppExeName ".exe"
#define MyUnins "卸载.exe"

[Setup]
; 注: AppId的值为单独标识该应用程序。
; 不要为其他安装程序使用相同的AppId值。
; (若要生成新的 GUID,可在菜单中点击 "工具|生成 GUID"。)
AppId=
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName={autopf}\{#MyAppName}
DefaultGroupName=采集工具2.0
DisableProgramGroupPage=yes
; 以下行取消注释,以在非管理安装模式下运行(仅为当前用户安装)。
;PrivilegesRequired=lowest
OutputBaseFilename=采集工具2.0
Compression=lzma
SolidCompression=yes
WizardStyle=modern
PrivilegesRequired=admin

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


[code]
procedure CurStepChanged(CurStep: TSetupStep);
var
uninspath, uninsname, NewUninsName, MyAppName: string;
begin
if CurStep=ssDone then
begin
// 指定新的卸载文件名(不包含扩展名),请相应修改!
NewUninsName := '卸载';
// 应用程序名称,与 [Setup] 段的 AppName 必须一致,请相应修改!
MyAppName := '采集工具';
// 以下重命名卸载文件
uninspath:= ExtractFilePath(ExpandConstant('{uninstallexe}'));
uninsname:= Copy(ExtractFileName(ExpandConstant('{uninstallexe}')),1,8);
RenameFile(uninspath + uninsname + '.exe', uninspath + NewUninsName + '.exe');
RenameFile(uninspath + uninsname + '.dat', uninspath + NewUninsName + '.dat');
// 以下修改相应的注册表内容
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + MyAppName + '_is1') then
begin
RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + MyAppName + '_is1', 'UninstallString', '"' + uninspath + NewUninsName + '.exe"');
RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + MyAppName + '_is1', 'QuietUninstallString', '"' + uninspath + NewUninsName + '.exe" /silent');
end;
end;
end;


[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone
;Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "E:\client\新建文件夹 (2)\people\people\bin\Release\采集工具.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\client\新建文件夹 (2)\people\people\bin\Release\*"; DestDir: "{app}"; Flags: ignoreversion  recursesubdirs createallsubdirs
; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion”

[Icons]

;Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}";
;Name: "{commonprograms}\卸载 {#MyAppName}"; Filename:{uninstallexe}; WorkingDir: {app};
;Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon ;

//开始菜单快捷方式
Name: "{commonprograms}\{#MyAppName}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; WorkingDir: {app};

//桌面快捷方式
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
//开始菜单卸载程序
;Name: {commonprograms}\{#MyAppName}\卸载 {#MyAppName}; Filename:{uninstallexe}; WorkingDir: {app};
Name: {commonprograms}\{#MyAppName}\卸载 {#MyAppName}; Filename:{app}\{#MyUnins}; WorkingDir: {app};
;Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}";
;卸载程序图标
;Name: "{group}\{#Close}"; Filename: "{uninstallexe}";
;主程序图标
;Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
;Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
;桌面卸载程序图标
;Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
[Registry]
Root: HKCR; Subkey: ".zjx"; ValueType: string; ValueName: ""; ValueData: "采集工具"
Root: HKCR; Subkey: "息采集工具\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0"; Flags: uninsdeletekey          
Root: HKCR; Subkey: "采集工具\Shell\Open\Command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" %1"; Flags:    uninsdeletekey
Root: HKCR; Subkey: "息采集工具\ShellNew"; ValueType: string; ValueName: "FileName"; ValueData: """{app}\{#MyAppExeName}"" %1"; Flags:    uninsdeletekey

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



posted @ 2020-07-30 11:23  尘梦  阅读(1463)  评论(0编辑  收藏  举报