You will need to extract the ISSkin.dll library along with the skin file in a specific directory and save it, unless your user starts the uninstaller. This is because the uninstaller is the application generated by the installation, and therefore they are simply different (the uninstaller, for example, does not contain files that can be extracted).
It is also necessary to consider that if you want the entire removal process to be cleared, you will need to unload the ISSkin.dll library at the very end of the removal process, and this will require you to delete the library with the skin file manually. To do this, I highly recommend that you use a folder other than the application to allow the uninstaller to correctly remove the application and do the rest yourself. Here is an example script that is used for this local application data folder:
You can also follow 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;
TLama
source share