Step One: Adding ISSkin and Visual Style DLL's
Getting started with ISSkin is simple. If you haven't already done so, obtain a copy of Inno Setup from the following url: www.jrsoftware.org.
The first thing you will need to do is open your installation script using Inno Setup. Locate the [Files] section, and add the ISSkin.dll and the Visual Style DLL. For the purposes of this example, we will be using the Office2007.cjstyles that is provided with the download.
[Files] ; Add the ISSkin DLL used for skinning Inno Setup installations. Source: ISSkin.dll; DestDir: {app}; Flags: dontcopy ; Add the Visual Style resource which contains resources used for skinning, ; you can also use Microsoft Visual Styles (*.msstyles) resources. Source: Office2007.cjstyles; DestDir: {tmp}; Flags: dontcopy
Step Two: Declare API Functions
After you have added the ISSkin and Visual Style DLL's to your installation script, the next things you will need to do is define a block of code that will load the ISSkin DLL and apply the Visual Style ( skin ) to your installation. To do this you will first need to find the [Code] block in your installation script. If you do not have one already defined, you can add one to the bottom of your script.
We need to import the LoadSkin and UnloadSkin ISSkin DLL API functions so we can Load and Unload each Visual Style (skin) for the Inno Setup installation. We will also need to import the ShowWindow API function to be used when the installation is closing, just before the skin has unloaded. To do this we can use the procedure and external keywords as seen below to import each function used.
[Code] // Importing LoadSkin API from ISSkin.DLL procedure LoadSkin(lpszPath: String; lpszIniFileName: String); external 'LoadSkin@files:isskin.dll stdcall'; // Importing UnloadSkin API from ISSkin.DLL procedure UnloadSkin(); external 'UnloadSkin@files:isskin.dll stdcall'; // Importing ShowWindow Windows API from User32.DLL function ShowWindow(hWnd: Integer; uType: Integer): Integer; external 'ShowWindow@user32.dll stdcall';
Step Three: Add InitializeSetup() Function
We need to add a InitializeSetup() function that is called when the Inno Setup installation is initializing. This is where we will place our code that loads the Visual Style (skin) for the installation. In the LoadSkin function pass in the path to the Visual Style DLL for the first argument, and the name of the schema ini file for the second argument.
The schema ini file is contains specific details for each style, and is embedded into the Visual Style DLL. If this parameter is left blank, the default schema will be used. For example if you were to pass in NormalAqua.ini as the second parameter for LoadSkin the Aqua schema would be used instead of the default schema in this case Blue.
function InitializeSetup(): Boolean; begin ExtractTemporaryFile('Office2007.cjstyles'); LoadSkin(ExpandConstant('{tmp}\Office2007.cjstyles'), ''); Result := True; end;
Step Four: Add DeinitializeSetup() Function
The last thing we need to do is add a DeinitializeSetup() function that is called when the Inno Setup installation is closing. This is where we will place our code that unloads the Visual Style (skin) before the installation is exited.
procedure DeinitializeSetup(); begin // Hide Window before unloading skin so user does not get // a glimpse of an unskinned window before it is closed. ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), 0); UnloadSkin(); end;