bairagyakushal4
#include "Modules\botva2.iss"
#define FormPic "form.png"
#define CloseBtnPic "closebtn.png"
#define GameExeOne "btn.png"
[Setup]
AppName=Luncher
AppVersion=1.5
CreateAppDir=no
OutputBaseFilename=Luncher
SetupIconFile=Files\icons.ico
VersionInfoDescription=Luncher for Back to the Future - The Game
[CustomMessages]
GameExeOne=Back to the Future - The Game Episode 1
GameExeTwo=Back to the Future - The Game Episode 2
GameExeThree=Back to the Future - The Game Episode 3
GameExeFour=Back to the Future - The Game Episode 4
GameExeFive=Back to the Future - The Game Episode 5
CloseButton=Exit
[Files]
Source: "Files\*"; Flags: dontcopy;
[code]
var
CloseButton,GameExeOne,GameExeTwo,GameExeThree,Gam eExeFour,GameExeFive: HWND;
Res: Integer;
function ReleaseCapture(): Longint; external '
[email protected] stdcall';
function InitializeSetup:boolean;
begin
if not FileExists(ExpandConstant('{tmp}\b2p.dll')) then ExtractTemporaryFile('b2p.dll');
if not FileExists(ExpandConstant('{tmp}\botva2.dll')) then ExtractTemporaryFile('botva2.dll');
if not FileExists(ExpandConstant('{tmp}\CallbackCtrl.dll' )) then ExtractTemporaryFile('CallbackCtrl.dll');
Result:=True;
end;
procedure LabelOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
SendMessage(WizardForm.Handle,$0112,$F012,0)
end;
procedure CloseBtnClick(hBtn:HWND);
begin
WizardForm.Close;
end;
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
Confirm:= false; Cancel:=False;
Cancel:= True;
end;
procedure GameExeOneBtnClick(hBtn:HWND);
begin
if not FileExists(ExpandConstant('{src}\inside episode 1\BackToTheFuture101.exe')) then
begin
MsgBox('Файл не найден!', mbError, MB_OK);
end else
Exec(ExpandConstant('{src}\inside episode 1\BackToTheFuture101.exe'), '', ExpandConstant('{src}\inside episode 1'), SW_SHOW, ewNoWait, Res);
WizardForm.Close;
end;
procedure GameExeTwoBtnClick(hBtn:HWND);
begin
if not FileExists(ExpandConstant('{src}\inside episode 2\BackToTheFuture102.exe')) then
begin
MsgBox('Файл не найден!', mbError, MB_OK);
end else
Exec(ExpandConstant('{src}\inside episode 2\BackToTheFuture102.exe'), '', ExpandConstant('{src}\inside episode 2'), SW_SHOW, ewNoWait, Res);
WizardForm.Close;
end;
procedure GameExeThreeBtnClick(hBtn:HWND);
begin
if not FileExists(ExpandConstant('{src}\inside episode 3\BackToTheFuture103.exe')) then
begin
MsgBox('Файл не найден!', mbError, MB_OK);
end else
Exec(ExpandConstant('{src}\inside episode 3\BackToTheFuture103.exe'), '', ExpandConstant('{src}\inside episode 3'), SW_SHOW, ewNoWait, Res);
WizardForm.Close;
end;
procedure GameExeFourBtnClick(hBtn:HWND);
begin
if not FileExists(ExpandConstant('{src}\inside episode 4\BackToTheFuture104.exe')) then
begin
MsgBox('Файл не найден!', mbError, MB_OK);
end else
Exec(ExpandConstant('{src}\inside episode 4\BackToTheFuture104.exe'), '', ExpandConstant('{src}\inside episode 4'), SW_SHOW, ewNoWait, Res);
WizardForm.Close;
end;
procedure GameExeFiveBtnClick(hBtn:HWND);
begin
if not FileExists(ExpandConstant('{src}\inside episode 5\BackToTheFuture105.exe')) then
begin
MsgBox('Файл не найден!', mbError, MB_OK);
end else
Exec(ExpandConstant('{src}\inside episode 5\BackToTheFuture105.exe'), '', ExpandConstant('{src}\inside episode 5'), SW_SHOW, ewNoWait, Res);
WizardForm.Close;
end;
procedure InitializeWizard();
begin
WizardForm.Caption:='Luncher for Back to the Future - The Game';
ExtractTemporaryFile('{#FormPic}');
ExtractTemporaryFile('{#GameExeOne}');
with WizardForm do begin
BorderStyle:=bsNone;
Bevel.Hide;
InnerNotebook.Hide;
OuterNotebook.Hide;
Width:=ScaleX(580);
Height:=ScaleY(358);
Position:=poScreenCenter;
end;
ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}')+ '\{#FormPic}',0,0,0,0,False,True);
GameExeOne:= BtnCreate(WizardForm.Handle, ScaleX(270), ScaleY(50), ScaleX(278), ScaleY(30), ExpandConstant('{tmp}')+'\{#GameExeOne}',0, False);
BtnSetEvent(GameExeOne, BtnClickEventID, WrapBtnCallback(@GameExeOneBtnClick, 1));
BtnSetText(GameExeOne, ExpandConstant('{cm:GameExeOne}'));
BtnSetFontColor(GameExeOne, clWhite, clWhite, clWhite, clWhite);
GameExeTwo:= BtnCreate(WizardForm.Handle, ScaleX(270), ScaleY(90), ScaleX(278), ScaleY(30), ExpandConstant('{tmp}')+'\{#GameExeOne}',0, False);
BtnSetEvent(GameExeTwo, BtnClickEventID, WrapBtnCallback(@GameExeTwoBtnClick, 1));
BtnSetText(GameExeTwo, ExpandConstant('{cm:GameExeTwo}'));
BtnSetFontColor(GameExeTwo, clWhite, clWhite, clWhite, clWhite);
GameExeThree:= BtnCreate(WizardForm.Handle, ScaleX(270), ScaleY(130), ScaleX(278), ScaleY(30), ExpandConstant('{tmp}')+'\{#GameExeOne}',0, False);
BtnSetEvent(GameExeThree, BtnClickEventID, WrapBtnCallback(@GameExeThreeBtnClick, 1));
BtnSetText(GameExeThree, ExpandConstant('{cm:GameExeThree}'));
BtnSetFontColor(GameExeThree, clWhite, clWhite, clWhite, clWhite);
GameExeFour:= BtnCreate(WizardForm.Handle, ScaleX(270), ScaleY(170), ScaleX(278), ScaleY(30), ExpandConstant('{tmp}')+'\{#GameExeOne}',0, False);
BtnSetEvent(GameExeFour, BtnClickEventID, WrapBtnCallback(@GameExeFourBtnClick, 1));
BtnSetText(GameExeFour, ExpandConstant('{cm:GameExeFour}'));
BtnSetFontColor(GameExeFour, clWhite, clWhite, clWhite, clWhite);
GameExeFive:= BtnCreate(WizardForm.Handle, ScaleX(270), ScaleY(210), ScaleX(278), ScaleY(30), ExpandConstant('{tmp}')+'\{#GameExeOne}',0, False);
BtnSetEvent(GameExeFive, BtnClickEventID, WrapBtnCallback(@GameExeFiveBtnClick, 1));
BtnSetText(GameExeFive, ExpandConstant('{cm:GameExeFive}'));
BtnSetFontColor(GameExeFive, clWhite, clWhite, clWhite, clWhite);
CloseButton:= BtnCreate(WizardForm.Handle, ScaleX(270), ScaleY(250), ScaleX(278), ScaleY(30), ExpandConstant('{tmp}')+'\{#GameExeOne}',0, False);
BtnSetEvent(CloseButton, BtnClickEventID, WrapBtnCallback(@CloseBtnClick, 1));
BtnSetText(CloseButton, ExpandConstant('{cm:CloseButton}'));
BtnSetFontColor(CloseButton, clWhite, clWhite, clWhite, clWhite);
with WizardForm.CancelButton do
begin
Left := ScaleX(399);
Top := ScaleY(495);
end;
with WizardForm.NextButton do
begin
Left := ScaleX(301);
Top := ScaleY(495);
end;
with TLabel.Create(WizardForm) do begin
Parent:=WizardForm;
AutoSize:=False;
Top:=3;
Left:=0;
Width:=WizardForm.Width;
Alignment:=taCenter;
Transparent:=True;
Font.Color:=$EEEEEE;
Font.Style:=[fsBold];
Caption:=WizardForm.Caption;
OnMouseDown:=@LabelOnMouseDown;
end;
with TLabel.Create(WizardForm) do begin
Parent:=WizardForm;
AutoSize:=False;
Top:=0;
Left:=0;
Width:=WizardForm.Width;
Height:= WizardForm.Height
Transparent:=True;
OnMouseDown:=@LabelOnMouseDown;
end;
ImgApplyChanges(WizardForm.Handle);
end;
procedure DeinitializeSetup;
begin
gdipShutdown;
end;
Thanks for the launcher.U r great.