Inno Setup 使用插件替换卸载程序图标

来源:互联网 发布:sql查询表中重复数据 编辑:程序博客网 时间:2024/05/21 07:14

;注意: 替换卸载程序的图标,必须是在卸载程序生成之前!
;建议安装图标与卸载图标的格式与大小一致,否则可能会导致卸载程序出错!
;要替换图标的exe文件路径名称留空,则插件会自动替换掉Inno卸载程序的图标!
[Files]
; 修改卸载图标插件,放在和生成exe iss相同目录
Source: "UpdateIcon.dll"; Flags: solidbreak dontcopy
; 卸载图标
Source: "Uninstall.ico"; Flags: solidbreak dontcopy
[code]
//使用插件替换卸载程序图标
function UpdateIcon(const hWnd: Integer; const exeFileName, exeIcon, IcoFileName: String; wlangID: DWORD): Boolean;
external 'UpdateIcon@files:UpdateIcon.dll stdcall';
function UpdateUninstIcon(const IcoFileName: String): Boolean;
begin
  Result:= UpdateIcon(MainForm.Handle, '', '', IcoFileName, 0);
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
  sIcon: String;
begin
  if CurStep=ssInstall then
  begin
    sIcon:= ExpandConstant('{tmp}/Uninstall.ico');
    ExtractTemporaryFile(ExtractFileName(sIcon));
    UpdateUninstIcon(sIcon)
  end;
end;

原创粉丝点击