装卸载面板中的图标一直是默认的图标,哪怕设置SetupIconFile或者UninstallIconFile依然如此,后来从网上查找资料,看到有使用UpdateIcon.dll去更新图标,研究了一下发现是为了应对卸载图标和安装图标不一致的情况,并不影响安装卸载面板,之后更换查找方式,寻找删除卸载图标,果然发现了解决方案,原来是在注册表中,具体方法:
[Code]
//在注册表中插入DisplayIcon项,指定安装卸载页面的程序图标;
function SetUninstallIcon(iconPath:string): Boolean;
var
InstalledVersion,SubKeyName: String;
begin
if (IsWin64()) then begin
//自己的appID
SubKeyName := 'Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{385D6211-F53F-4669-8368-441D552F892B}_is1';
RegWriteStringValue(HKLM64,SubKeyName,'DisplayIcon',iconPath);
end else begin
SubKeyName := 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{385D6211-F53F-4669-8368-441D552F892B}_is1';
RegWriteStringValue(HKLM,SubKeyName,'DisplayIcon',iconPath);
end;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpFinished then
begin
SetUninstallIcon(ExpandConstant('{app}\icon.ico'));
end;
end