Coding4ever’s Blog

Just coding… coding… and coding… because coding should be fun :)

Menambahkan Skin Pada Paket Instalasi (Inno Setup)

| Comments

Inilah krennya inno setup selain gratis dan open source juga banyak tersedia Third-Party Files, salah satunya ISSkin dari codejock.

Sebelum kita menambahkan skin, kita lihat dulu tampilan standar paket instalasi yang dibuat menggunakan inno setup.

Dan kita lihat setelah menambahkan skin

Gimana ? Menarik bukan ? :)

Oke langsung saja download sample ISSkin disini, ekstrak file ISSkinExample.zip dan terakhir jalankan file ISSkin.exe

Apakah cukup seperti itu saja ? Tentu tidak, kita harus menambahkan beberapa baris kode pada skrip inno setup di bagian [Files] dan [Code].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
[Files]
; Add the ISSkin DLL used for skinning Inno Setup installations.
Source: ISSkin.dll; DestDir: {app}; Flags: dontcopy

; Add the Visual Style resource contains resources used for skinning,
; you can also use Microsoft Visual Styles (*.msstyles) resources.
Source: Styles\Office2007.cjstyles; DestDir: {tmp}; Flags: dontcopy

; The following code block is used to load the ISS, pass in
; NormalAqua.ini as the second parameter to LoadSkin to use
; the Aqua color scheme instead of the default Blue color
; scheme.
[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’;

function InitializeSetup(): Boolean;
begin
  ExtractTemporaryFile(‘Office2007.cjstyles’);
  LoadSkin(ExpandConstant(‘{tmp}\Office2007.cjstyles’), ‘NormalAqua.ini’);
  Result := True;
end;

procedure DeinitializeSetup();
begin
  // Hide Window before unloading skin so user does not get
  // a glimse of an unskinned window before it is closed.
  ShowWindow(StrToInt(ExpandConstant(‘{wizardhwnd}’)), 0);
  UnloadSkin();
end;

Berikut adalah beberapa variasi skin hasil dari ngoprek kode berikut :

1
LoadSkin(ExpandConstant(‘{tmp}\Office2007.cjstyles’), ‘NormalAqua.ini’);

1
LoadSkin(ExpandConstant(‘{tmp}\Office2007.cjstyles’), ‘NormalBlack.ini’);

1
LoadSkin(ExpandConstant(‘{tmp}\Vista.cjstyles’), ‘NormalSilver.ini’);

1
LoadSkin(ExpandConstant(‘{tmp}\Vista.cjstyles’), ‘’);

Selamat mencoba :)

Comments