Code:
[Setup]
AppName=setup
AppVerName=setup
OutputDir=.
DefaultDirName={pf}\setup
[Files]
Source: Data\*; DestDir: "{tmp}"; Flags: dontcopy
[Code]
var
Btn:TButton;
Font:TFont;
hNextBtn:HWND;
const
FR_PRIVATE= $10;
BtnClickEventID= 1;
BtnMouseEnterEventID = 2;
type
Tfnlabel=procedure(h,msg,idevent,dwTime:longword);
HSTREAM = DWORD;
TBtnEventProc = procedure (h:HWND);
function MessageBox(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer;external '[email protected] stdcall';
procedure SetupLoadSkin(lpszPath: string; lpszIniFileName: string); external 'LoadSkin@files:ISSkin.dll stdcall setuponly';
procedure SetupUnloadSkin; external 'UnloadSkin@files:ISSkin.dll stdcall setuponly';
procedure ShowSplashScreen(p1:HWND;p2:AnsiString;p3,p4,p5,p6,p7:integer;p8:boolean;p9:Cardinal;p10 :integer); external 'ShowSplashScreen@files:isgsg.dll stdcall delayload';
function ShowWindow(hWnd: HWND; nCmdShow: Integer): BOOL; external '[email protected] stdcall';
function SetTimer(hWnd: longword; nIDEvent, uElapse: longword; lpTimerFunc: longword): longword;external '[email protected] stdcall';
function KillTimer(hWnd, nIDEvent: LongWord): LongWord;external 'KillTimer@user32 stdcall delayload';
function fnlCallback(callback:Tfnlabel; paramcount:integer):longword;external 'wrapcallback@files:innocallback.dll stdcall';
function ImgLoad(Wnd :HWND; FileName :PAnsiChar; Left, Top, Width, Height :integer; Stretch, IsBkg :boolean) :Longint; external 'ImgLoad@{tmp}\botva2.dll stdcall delayload';
procedure ImgSetVisibility(img :Longint; Visible :boolean); external 'ImgSetVisibility@{tmp}\botva2.dll stdcall delayload';
procedure BtnGetPosition(h:HWND; var Left, Top, Width, Height: integer); external 'BtnGetPosition@{tmp}\botva2.dll stdcall delayload';
procedure ImgApplyChanges(h:HWND); external 'ImgApplyChanges@{tmp}\botva2.dll stdcall delayload';
procedure gdipShutdown; external 'gdipShutdown@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetFontColor(h :HWND; NormalFontColor, FocusedFontColor, PressedFontColor, DisabledFontColor :Cardinal); external 'BtnSetFontColor@{tmp}\botva2.dll stdcall delayload';
function WrapBtnCallback(Callback: TBtnEventProc; ParamCount: Integer): Longword; external 'wrapcallback@{tmp}\innocallback.dll stdcall delayload';
function BtnCreate(hParent:HWND; Left,Top,Width,Height:integer; FileName:PAnsiChar; ShadowWidth:integer; IsCheckBtn:boolean):HWND; external 'BtnCreate@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetEvent(h:HWND; EventID:integer; Event:Longword); external 'BtnSetEvent@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetText(h :HWND; Text :PAnsiChar); external 'BtnSetText@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetVisibility(h :HWND; Value :boolean); external 'BtnSetVisibility@{tmp}\botva2.dll stdcall delayload';
procedure BtnSetFont(h :HWND; Font :Cardinal); external 'BtnSetFont@{tmp}\botva2.dll stdcall delayload';
function sndPlaySound(lpszSoundName: String; uFlags: cardinal):integer; external '[email protected] stdcall';
procedure WizardFormBtnClick(hBtn:HWND); begin
sndPlaysound(ExpandConstant('{tmp}\soundfx.wav'),$0001);
case hBtn of
hNextBtn: Btn:=WizardForm.NextButton;
end;
Btn.OnClick(Btn);
end;
procedure WizardFormBtnOnMouseEnter(hBtn:HWND); begin
sndPlaysound(ExpandConstant('{tmp}\soundfx.wav'),$0001);
end;
function InitializeSetup(): Boolean; begin
ExtractTemporaryFile('botva2.dll');
ExtractTemporaryFile('button.png');
ExtractTemporaryFile('BASS.dll');
ExtractTemporaryFile('CallbackCtrl.dll');
ExtractTemporaryFile('soundfx.wav');
Result := True;
end;
procedure InitializeWizard(); begin
with WizardForm do begin
Position:=poScreenCenter;
InnerNotebook.Hide;
OuterNotebook.Hide;
Bevel.Hide;
BorderStyle:= bsDialog;
ClientWidth:=600
ClientHeight:=400
CancelButton.SetBounds(510,365,70,20);
BackButton.SetBounds(350,365,70,20);
NextButton.SetBounds(430,365,70,20);
end
with WizardForm.NextButton do begin
hNextBtn:=BtnCreate(WizardForm.Handle,Left-8,Top-8,Width+10,Height+10,ExpandConstant('{tmp}\button.png'),18,False);
BtnSetEvent(hNextBtn,BtnClickEventID,WrapBtnCallback(@WizardFormBtnClick,1));
BtnSetFontColor(hNextBtn,$ffcc33,$0000FF,$000000,$000000);
BtnSetEvent(hNextBtn,BtnClickEventID,WrapBtnCallback(@WizardFormBtnClick,1));
BtnSetEvent(hNextBtn,BtnMouseEnterEventID,WrapBtnCallback(@WizardFormBtnOnMouseEnter,1));
Width:=0;
Height:=0;
end;
//h:=WizardForm.Handle;
ImgApplyChanges(WizardForm.Handle);
end;
procedure DeinitializeSetup(); begin
BASS_Free;
ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), SW_HIDE);
SetupUnloadSkin;
gdipShutdown;
end;
procedure CurPageChanged(CurPageID: Integer); begin
ImgApplyChanges(WizardForm.Handle);
BtnSetText(hNextBtn,WizardForm.NextButton.Caption);
if (CurPageID = wpFinished) then begin
BtnSetVisibility(hNextBtn,True);
end;
if (CurPageID = wpInstalling) then begin
BtnSetVisibility(hNextBtn,False);
end;
end;