PDA

View Full Version : Add Alpha Skins support to Inno Setup: Tutorial


altef_4
03-10-2020, 14:09
Hi all, after some testing and searching and also request from
Cuttlas (https://fileforums.com/member.php?u=253256), i decide to upload step-by-step tutorial how to add alpha skins support into inno setup, like title said, so lets go.

you must be abble to compile inno setup on your PC (inno setup source code (https://github.com/jrsoftware/issrc)), follow instructions from provided link
download latest alpha skins lite pacage from alphaskins site (https://www.alphaskins.com/dwnld.php), and install it in your delphi IDE, use lite version cuz it free
in addition also download and install RemObjects (https://www.remobjects.com/ps.aspx) component and install it
i don't provide step-by-step instructions for this steps cuz all installation info is present on links i provided

open Setup.dpr project (.\issrc-master\Projects\Setup.dpr)
select build configuration to Release
optional: edit build configuration by adding postbuild event command - copy /B "$(OutputPath)" "..\Files\$(OutputName).e32"
this command will copy Setup.exe to FIles\Setup.e32
add AlphaSkins_R.Pas to Setup.dpr
open AlphaSkins_R.dfm and configure sSkinManager as you wont(effects, animations etc)
in attached archive present base AlphaSkins_R.Pas and AlphaSkins_C.Pas, use them as start point
open ScriptClasses_R.pas and add AlphaSkins_R unit in uses section
search for "RegisterBidiCtrls_R(Cl);"
add "RegisterSkinManager_R(Cl);" after it
search for "ScriptClassesLibraryUpdateVars"
add "SetVariantToClass(ScriptInterpreter.GetVarNo(Scrip tInterpreter.GetVar('SKINMANAGER')), DataModule1.SkinManager);" line as first call in function
view source of Setup.dpr and search for "Application.CreateForm(TDataModule1, DataModule1);" and remove it
search for "Application.HookMainWindow(TDummyClass.AntiShutdow nHook);" and add "Application.CreateForm(TDataModule1, DataModule1);" after it
recompile Setup.exe
open ISCmplr.dpr
select build configuration to Release
optional: edit build configuration by adding postbuild event command - copy /B "$(OutputPath)" "..\Files\$(OUTPUTFILENAME)"
this command will copy ISCmplr.dll to FIles\ISCmplr.dll
add AlphaSkins_C.pas to ISCmplr.dpr
open ScriptClasses_C.pas and add AlphaSkins_C unit in uses section
search for "AddImportedClassVariable(Cl, 'WizardForm', 'TWizardForm');"
add "RegisterSkinManager_C(Cl);" line before "AddImportedClassVariable(Cl, 'WizardForm', 'TWizardForm');" line
recompile ISCmplr.dll
compile Compil32.dpr, ISCC, ISPP, SetupLdr projects
copy destination compiled project binaries into Files folder
create inno setup script file in FIles folder with following content:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
Compression=lzma2
SolidCompression=yes
DisableWelcomePage=no
OutputDir=.\
//WindowVisible=True

[Code]
procedure SetSkinParameters(u: Boolean);
begin
with SkinManager do begin
if not u then begin
SkinDirectory := ExpandConstant('{src}\Skins_V15\')
SkinName := GetRandomSkin;
//SkinName := ExpandConstant('{src}\Skins_V15\Pulsar.asz');
end;
//HUEOffset := Random(360); //value from 0 to 360
//Saturation := Random(200) - 100; //value from -100 to 100
//Brightness := Random(40) - 25; //value from -25 to 15
Active := TRUE;
end;
end;
function SetWindowLong(Wnd: HWnd; Index: Integer; NewLong: Longint): Longint; external '[email protected] stdcall';
function GetWindowLong(Wnd: HWnd; Index: Integer): Longint; external '[email protected] stdcall';
function GetWindow (HWND: Longint; uCmd: cardinal): Longint;external '[email protected] stdcall';


function InitializeSetup: Boolean;
begin
SetSkinParameters(False);
Result := TRUE;
end;

function InitializeUninstall: Boolean;
begin
SetSkinParameters(True);
Result := TRUE;
end;

procedure InitializeWizard;
begin
SetWindowLong(WizardForm.Handle, -8,GetWindowLong(GetWindow(WizardForm.Handle, 4),-8));
WizardForm.BorderStyle := BsSizeable; //work with this style, only wizardform
end;

NewStaticText aligment fix:
open Components/NewStaticText.pas
add FAlignment: TAlignment; into private section of TNewStaticText Class
add procedure SetAlignment(Value: TAlignment); into private section of TNewStaticText Class
add property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify; into published section of TNewStaticText Class
press Ctrl+Shift+C and search for TNewStaticText.SetAlignment
add following code into this procedure:

if FAlignment <> Value then
begin
FAlignment := Value;
RecreateWnd;
end;

save NewStaticText.pas and recompile Setup.dpr
5px frame fix
Remove or comment '//' this 2 lines in setup.dpr file:
{$SETPEOSVERSION 6.0}
{$SETPESUBSYSVERSION 6.0}
and recompile setup.e32 (setup.dpr file), thanks for fix Cuttlas, there is attached 5px_frame_fix.zip with recompiled setup.e32 and edited setup.dpr, not sure if this change can couse any bugs in inno setup itself

attached archive containe all this changes and inno setup 6.0.4 src version, i tryed to check if it works on latest beta source but i get some errors during compilation of original unchanged source and i don't have time to figure out how to fix this errors, so at least it work with this version and should work with new one, also 5px_frame_fix.zip contains setup.dpr with necessary changes to fix 5 px unskined frame and recompiled setup.e32 file, so to use this fix just replace setup.e32 file in base archive with new one

Cuttlas
03-10-2020, 22:11
Thank you altef_4, my bro :)

nice and clean.

Cuttlas
03-10-2020, 22:50
I think this post should be Sticky

altef_4
15-10-2020, 00:14
First post updated, added 5px frame fix, thanks for info about fix going to Cuttlas (https://fileforums.com/member.php?u=253256)
Info about fix:
{$SETPEOSVERSION 6.0}
{$SETPESUBSYSVERSION 6.0}
if required Windows version is old (6.0), then GetWindowRect and GetClientRect functions works not correctly under new Windows versions