gpt4 book ai didi

inno-setup - 如何使用ISSkin库将皮肤应用于Inno Setup卸载程序?

转载 作者:行者123 更新时间:2023-12-04 04:12:22 27 4
gpt4 key购买 nike

我知道,如何将带有ISSkin add-on的皮肤应用于Inno Setup的安装程序部分,但我不知道如何为Inno Setup卸载程序执行相同操作。

如何使用ISSkin add-on将皮肤也应用到卸载程序?

最佳答案

除非您的用户运行卸载程序,否则您将必须将ISSkin.dll库和外观文件一起提取到某个目录中并进行存储。这是因为卸载程序是由安装程序生成的应用程序,因此它们是不同的(卸载程序例如不包含可以提取的文件)。

您还需要考虑到,如果要对整个卸载过程进行皮肤化,则需要在卸载过程结束时卸载ISSkin.dll库,这将需要您删除该库手动设置皮肤文件。为此,我强烈建议您使用与应用程序不同的文件夹,以使卸载程序正确删除该应用程序,其余的则由您自己完成。这是一个脚本示例,用于此本地应用程序数据文件夹:

您也可以关注the commented version of this code

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
OutputDir=userdocs:Inno Setup Examples Output

#define SetupSkinPath "{localappdata}\SetupSkin"

[Files]
Source: ISSkinU.dll; DestDir: {#SetupSkinPath}; Flags: uninsneveruninstall
Source: Styles\Office2007.cjstyles; DestDir: {#SetupSkinPath}; Flags: uninsneveruninstall

[Code]
procedure SetupLoadSkin(lpszPath: string; lpszIniFileName: string);
external 'LoadSkin@files:ISSkinU.dll stdcall setuponly';
procedure SetupUnloadSkin;
external 'UnloadSkin@files:ISSkinU.dll stdcall setuponly';
procedure UninstLoadSkin(lpszPath: string; lpszIniFileName: string);
external 'LoadSkin@{#SetupSkinPath}\ISSkinU.dll stdcall uninstallonly';
procedure UninstUnloadSkin;
external 'UnloadSkin@{#SetupSkinPath}\ISSkinU.dll stdcall uninstallonly';
function ShowWindow(hWnd: HWND; nCmdShow: Integer): BOOL;
external 'ShowWindow@user32.dll stdcall';

function InitializeSetup: Boolean;
begin
Result := True;
ExtractTemporaryFile('Office2007.cjstyles');
SetupLoadSkin(ExpandConstant('{tmp}\Office2007.cjstyles'), 'NormalBlack.ini');
end;

procedure DeinitializeSetup;
begin
ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), SW_HIDE);
SetupUnloadSkin;
end;

function InitializeUninstall: Boolean;
begin
Result := True;
UninstLoadSkin(ExpandConstant('{#SetupSkinPath}\Office2007.cjstyles'),
'NormalBlack.ini');
end;

procedure DeinitializeUninstall;
begin
UninstUnloadSkin;
UnloadDLL(ExpandConstant('{#SetupSkinPath}\ISSkinU.dll'));
DeleteFile(ExpandConstant('{#SetupSkinPath}\ISSkinU.dll'));
DeleteFile(ExpandConstant('{#SetupSkinPath}\Office2007.cjstyles'));
RemoveDir(ExpandConstant('{#SetupSkinPath}'));
end;

关于inno-setup - 如何使用ISSkin库将皮肤应用于Inno Setup卸载程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14591424/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com