簡體   English   中英

如何使用ISSkin庫將皮膚應用於Inno Setup卸載程序?

[英]How to apply a skin to Inno Setup uninstaller with the ISSkin library?

我知道,如何 Inno Setup的安裝程序部分中應用帶有ISSkin插件的皮膚,但我無法弄清楚,如何為Inno Setup卸載程序執行相同操作。

如何將帶有ISSkin插件的皮膚也應用於卸載程序?

除非用戶運行卸載程序,否則您必須將ISSkin.dll庫以及外觀文件解壓縮到某個目錄中並保存。 這是因為卸載程序是由安裝程序生成的應用程序,因此它們只是不同(卸載程序,例如不包含可以提取的文件)。

您還需要考慮,如果您希望將整個卸載過程設置為皮膚,則需要在卸載過程的最后卸載ISSkin.dll庫,這將需要您刪除手動使用皮膚文件的庫。 為此,我強烈建議您使用與應用程序不同的文件夾,以允許卸載程序正確刪除應用程序,其余部分由您自己執行。 這是一個腳本示例,用於此本地應用程序數據文件夾:

您也可以按照此代碼的注釋版本進行操作

[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;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM