Menambahkan skin pada paket instalasi (Inno Setup)

Posted by Kamarudin • 1 minute read • 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].

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

LoadSkin(ExpandConstant('{tmp}\Office2007.cjstyles'), 'NormalAqua.ini');

LoadSkin(ExpandConstant('{tmp}\Office2007.cjstyles'), 'NormalBlack.ini');

LoadSkin(ExpandConstant('{tmp}\Vista.cjstyles'), 'NormalSilver.ini');

LoadSkin(ExpandConstant('{tmp}\Vista.cjstyles'), '');

Selamat mencoba :blush:

Comments