i think this is what you asked..
Code:
var HForm: TSetupForm;
AbgImage : TBitmapImage;
#ifdef AutorunStandardButtons
Button1,Button2,Button3: TNewButton;
#endif
#ifdef AutorunLabelButtons
ButtonLabel1,ButtonLabel2,ButtonLabel3,ButtonLabel4,LabelMouse : TLabel;
ButtonsLabelShadow: array [1..4] of TLabel;
#endif
#ifdef AMusicLoop
MLabel : TLabel;
MPanel: Tpanel;
MBitmap : TBitmapImage;
#endif
MCIstr: PChar;
Install: Boolean;
mute: byte;
const
AWidth= 704;
AHeight= 372;
SND_OPT= $1;
OnMouseOutALabelButtonsFontSize= 17;
OnMouseOverALabelButtonsFontSize= 20;
AFontName= 'Impact';
LabelButtonsTop= 325;
LabelButtonsLeft= 85;
#ifdef AutorunLabelButtons
procedure ButtonLabelMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
TLabel(sender).Font.Size:=OnMouseOverALabelButtonsFontSize;
TLabel(sender).Font.Color:=ClRed;
ButtonsLabelShadow[TLabel(Sender).Tag].Font.Size:= OnMouseOverALabelButtonsFontSize;
end;
procedure LabelMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
ButtonLabel1.Font.Size:=OnMouseOutALabelButtonsFontSize;
ButtonsLabelShadow[1].Font.Size:= OnMouseOutALabelButtonsFontSize;
ButtonLabel1.Font.Color:= ClWhite;
ButtonLabel2.Font.Size:=OnMouseOutALabelButtonsFontSize;
ButtonsLabelShadow[2].Font.Size:= OnMouseOutALabelButtonsFontSize;
ButtonLabel2.Font.Color:= ClWhite;
ButtonLabel3.Font.Size:=OnMouseOutALabelButtonsFontSize;
ButtonsLabelShadow[3].Font.Size:= OnMouseOutALabelButtonsFontSize;
ButtonLabel3.Font.Color:= ClWhite;
ButtonLabel4.Font.Size:=OnMouseOutALabelButtonsFontSize;
ButtonLabel4.Font.Color:= ClWhite;
ButtonsLabelShadow[4].Font.Size:= OnMouseOutALabelButtonsFontSize;
end;
procedure BrowseLabelOnClick(Sender: TObject);
var
ErrorCode: Integer;
begin
PlaySound(expandConstant('{tmp}\Click.wav'),0,SND_OPT);
ShellExec('', ExpandConstant('{src}'),
'', '', SW_SHOW, ewNoWait, ErrorCode);
end;
procedure ButtonMove(Sender: TObject);
begin
PlaySound(expandConstant('{tmp}\Click.wav'),0,SND_OPT);
end;
procedure ButtonMove1(Sender: TObject);
begin
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\CD Projekt Red\The Witcher 2') then
PlaySound(expandConstant('{tmp}\Click.wav'),0,SND_OPT);
end;
procedure PILabelOnClick(Sender: TObject);
Var ResultCode: integer;
appath: string;
begin
PlaySound(expandConstant('{tmp}\Click.wav'),0,SND_OPT);
if TLabel(sender).caption=ExpandConstant('{cm:AInstall}') then begin
HForm.Close
Install:=True;
end else begin
RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\CD Projekt Red\The Witcher 2',
'InstallFolder', appath)
if not Exec(appath+'\Launcher.exe', '', '', SW_SHOW,
ewNoWait, ResultCode) then MsgBox(SysErrorMessage(ResultCode)+': Launcher.exe', mbCriticalError, MB_OK)
else begin
HForm.Close;
Install:=False;
end;
end;
end;
procedure UnInstLabelOnClick(Sender: TObject);
Var ResultCode: integer;
appath: string;
begin
PlaySound(expandConstant('{tmp}\Click.wav'),0,SND_OPT);
RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\CD Projekt Red\The Witcher 2',
'InstallFolder', appath)
Exec((appath +'\unins000.exe'), '', '', SW_SHOW,
ewNoWait, ResultCode)
HForm.Close
Install:=False;
end;
procedure ExitLabelOnClick(Sender: TObject);
begin
PlaySound(expandConstant('{tmp}\Click.wav'),0,SND_OPT);
HForm.Close
Install:=False;
end;
#endif
#ifdef AutorunStandardButtons
procedure PIButtonOnClick(Sender: TObject);
Var ResultCode: integer;
appath: string;
begin
PlaySound(expandConstant('{tmp}\Click.wav'),0,SND_OPT);
if TNewButton(sender).caption=ExpandConstant('{cm:AInstall}') then begin
HForm.Close
Install:=True;
end else begin
RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\CD Projekt Red\The Witcher 2',
'InstallPath', appath)
if not Exec(appath+'\Launcher.exe', '', '', SW_SHOW,
ewNoWait, ResultCode) then MsgBox(SysErrorMessage(ResultCode)+': Launcher.exe', mbCriticalError, MB_OK)
else begin
HForm.Close;
Install:=False;
end;
end;
end;
procedure ExitButtonOnClick(Sender: TObject);
begin
PlaySound(expandConstant('{tmp}\Click.wav'),0,SND_OPT);
HForm.Close
Install:=False;
end;
procedure UnInstButtonOnClick(Sender: TObject);
Var ResultCode: integer;
appath: string;
begin
PlaySound(expandConstant('{tmp}\Click.wav'),0,SND_OPT);
RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\CD Projekt Red\The Witcher 2',
'InstallFolder', appath)
Exec((appath +'\unins000.exe'), '', '', SW_SHOW,
ewNoWait, ResultCode)
HForm.Close
Install:=False;
end;
#endif
#ifdef AMusicLoop
procedure MLabelOnClick(Sender: TObject);
begin
PlaySound(expandConstant('{tmp}\Click.wav'),0,SND_OPT);
Case mute of
0: begin
mciSendString('PAUSE AMusicLoop', MCIstr, 255, 0);
MBitmap.Left:=ScaleX(-23);
mute:=1;
end;
1: begin
mciSendString('PLAY AMusicLoop REPEAT', MCIstr, 255, 0);
MBitmap.Left:=0;
mute:=0;
end;
end;
end;
#endif
function LaunchAutorun: Boolean;
begin
#ifdef AMusicLoop
ExtractTemporaryFile('{#Autorunmp3filename}');
ExtractTemporaryFile('mute_on_off.bmp');
#endif
ExtractTemporaryFile('{#ClickSoundfilename}');
ExtractTemporaryFile('AutorunBGI.BMP');
HForm:=CreateCustomForm;
With HForm Do
Begin
ClientWidth:=AWidth;
ClientHeight:=AHeight;
Position := poScreenCenter;
BorderIcons := [biSystemMenu];
Caption:=ExpandConstant('{cm:AppName} - Autorun');
end;
AbgImage:=TBitmapImage.Create(HForm);
With AbgImage Do
Begin
Parent:=HForm;
Align:=alClient;
Stretch:=True;
end;
AbgImage.bitmap.LoadFromFile(ExpandConstant('{tmp}\AutorunBGI.BMP'));
#ifdef AutorunLabelButtons
LabelMouse:=TLabel.Create(HForm);
With LabelMouse Do
Begin
Parent:=HForm;
Transparent:=True;
Width:=HForm.Width;
Height:=HForm.Height;
Caption:='';
OnMouseMove := @LabelMouseMove;
end;
#endif
#ifdef AutorunStandardButtons
Button1:=TNewButton.Create(HForm);
With Button1 Do
Begin
Parent:=HForm;
Left:= 150;
Top:=279;
Cursor:=crHand;
OnClick := @PIButtonOnClick;
OnMouseEnter:=@ButtonMove
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\CD Projekt Red\The Witcher 2') then Caption:=ExpandConstant('{cm:APlay}') else Caption:=ExpandConstant('{cm:AInstall}');
end;
Button2:=TNewButton.Create(HForm);
With Button2 Do
Begin
Parent:=HForm;
Caption:=ExpandConstant('{cm:AUnistall}');
Left:=249;
Top:=Button1.Top;
Cursor:=crHand;
OnClick := @UnInstButtonOnClick;
OnMouseEnter:=@ButtonMove
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\CD Projekt Red\The Witcher 2') then Enabled:=True else Enabled:=False;
end;
Button3:=TNewButton.Create(HForm);
With Button3 Do
Begin
Parent:=HForm;
Caption:=ExpandConstant('{cm:Aexit}');
Left:=348;
Top:=Button1.Top;
Cursor:=crHand;
OnClick := @ExitButtonOnClick;
OnMouseEnter:=@ButtonMove
end;
#endif
#ifdef AMusicLoop
MPanel := TPanel.Create(HForm);
with MPanel do
begin
Left := 672;
Top := 9;
Width := 23;
Height := 23;
Caption := '';
Parent := HForm;
end;
MBitmap := TBitmapImage.Create(HForm);
with MBitmap do
begin
Parent := MPanel;
Left := ScaleX(0);
Top := ScaleY(0);
Width := ScaleX(46);
Height := ScaleY(23);
MBitmap.bitmap.loadfromfile(ExpandConstant('{tmp}\mute_on_off.bmp'))
end;
MLabel:=TLabel.Create(HForm);
With MLabel Do
Begin
Parent:=MPanel;
Transparent:=True;
Left:=0;
Top:=0;
Font.Color:=ClWhite;
Width:=23;
Height:=23;
Autosize:=False;
Caption:='';
Font.Name:='Arial';
Font.Style:=[fsBold];
Font.Size:= 7;
Cursor:=crHand;
OnClick := @MLabelOnClick;
OnMouseEnter:=@ButtonMove
end;
mute:=0;
#endif
#ifdef AutorunLabelButtons
ButtonsLabelShadow[1]:=TLabel.Create(HForm);
With ButtonsLabelShadow[1] Do
Begin
Parent:=HForm;
Transparent:=True;
Left:=LabelButtonsLeft+ScaleX(1);
Top:=LabelButtonsTop+ScaleY(2);
Font.Color:=clBlack;
AutoSize:=True;
Caption:='';
Font.Name:=AFontName;
Font.Style:=[];
Font.Size:= OnMouseOutALabelButtonsFontSize;
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\CD Projekt Red\The Witcher 2') then Caption:=ExpandConstant('{cm:APlay}') else Caption:=ExpandConstant('{cm:AInstall}');
end;
ButtonLabel1:=TLabel.Create(HForm);
With ButtonLabel1 Do
Begin
Parent:=HForm;
Transparent:=True;
Left:=LabelButtonsLeft;
Top:=LabelButtonsTop;
Font.Color:=ClWhite;
AutoSize:=True;
Caption:='';
Font.Name:=AFontName;
Font.Style:=[];
Font.Size:= OnMouseOutALabelButtonsFontSize;
Cursor:=crHand;
Tag:=1;
OnClick := @PILabelOnClick;
OnMouseEnter:=@ButtonMove
OnMouseMove := @ButtonLabelMouseMove;
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\CD Projekt Red\The Witcher 2') then Caption:=ExpandConstant('{cm:APlay}') else Caption:=ExpandConstant('{cm:AInstall}');
end;
ButtonsLabelShadow[2]:=TLabel.Create(HForm);
With ButtonsLabelShadow[2] Do
Begin
Parent:=HForm;
Transparent:=True;
Left:=LabelButtonsLeft+ScaleY(102);
Top:=ButtonLabel1.Top+ScaleY(2);
Font.Color:=clBlack;
AutoSize:=True;
Caption:=ExpandConstant('{cm:AUnistall}');
Font.Name:=AFontName;
Font.Style:=[];
Font.Size:= OnMouseOutALabelButtonsFontSize;
end;
ButtonLabel2:=TLabel.Create(HForm);
With ButtonLabel2 Do
Begin
Parent:=HForm;
Transparent:=True;
Left:=LabelButtonsLeft+ScaleY(101);
Top:=ButtonLabel1.Top;
Font.Color:=ClWhite;
AutoSize:=True;
Caption:=ExpandConstant('{cm:AUnistall}');
Font.Name:=AFontName;
Font.Style:=[];
Font.Size:= OnMouseOutALabelButtonsFontSize;
Cursor:=crHand;
Tag:=2;
OnClick := @UnInstLabelOnClick;
OnMouseMove := @ButtonLabelMouseMove;
OnMouseEnter:=@ButtonMove1
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\CD Projekt Red\The Witcher 2') then Enabled:=True else Enabled:=False;
end;
ButtonsLabelShadow[3]:=TLabel.Create(HForm);
With ButtonsLabelShadow[3] Do
Begin
Parent:=HForm;
Transparent:=True;
Left:=LabelButtonsLeft+ScaleY(282);
Top:=ButtonLabel2.Top+ScaleY(2);
Font.Color:=clBlack;
AutoSize:=True;
Caption:=ExpandConstant('{cm:ABrowse}');
Font.Name:=AFontName;
Font.Style:=[];
Font.Size:= OnMouseOutALabelButtonsFontSize;
end;
ButtonLabel3:=TLabel.Create(HForm);
With ButtonLabel3 Do
Begin
Parent:=HForm;
Transparent:=True;
Left:=LabelButtonsLeft+ScaleY(281);
Top:=ButtonLabel2.Top;
Font.Color:=ClWhite;
AutoSize:=True;
Caption:=ExpandConstant('{cm:ABrowse}');
Font.Name:=AFontName;
Font.Style:=[];
Font.Size:= OnMouseOutALabelButtonsFontSize;
Cursor:=crHand;
Tag:=3;
OnClick := @BrowseLabelOnClick;;
OnMouseMove := @ButtonLabelMouseMove;
OnMouseEnter:=@ButtonMove
end;
ButtonsLabelShadow[4]:=TLabel.Create(HForm);
With ButtonsLabelShadow[4] Do
Begin
Parent:=HForm;
Transparent:=True;
Left:=LabelButtonsLeft+ScaleY(500);
Top:=ButtonLabel3.Top+ScaleY(2);
Font.Color:=clBlack;
AutoSize:=True;
Caption:=ExpandConstant('{cm:Aexit}');
Font.Name:=AFontName;
Font.Style:=[];
Font.Size:= OnMouseOutALabelButtonsFontSize;
end;
ButtonLabel4:=TLabel.Create(HForm);
With ButtonLabel4 Do
Begin
Parent:=HForm;
Transparent:=True;
Left:=LabelButtonsLeft+ScaleY(499);
Top:=ButtonLabel3.Top;
Font.Color:=ClWhite;
AutoSize:=True;
Caption:=ExpandConstant('{cm:Aexit}');
Font.Name:=AFontName;
Font.Style:=[];
Font.Size:= OnMouseOutALabelButtonsFontSize;
Cursor:=crHand;
Tag:=4;
OnClick := @ExitLabelOnClick;
OnMouseMove := @ButtonLabelMouseMove;
OnMouseEnter:=@ButtonMove
end;
#endif
#ifdef AMusicLoop
mciSendString('OPEN ' + ExpandConstant('{tmp}') + '\{#Autorunmp3filename} TYPE MPEGVIDEO ALIAS AMusicLoop', MCIstr, 255, 0);
mciSendString('PLAY AMusicLoop REPEAT', MCIstr, 255, 0);
#endif
HForm.ShowModal;
#ifdef AMusicLoop
mciSendString('STOP AMusicLoop', MCIstr, 255, 0);
#endif
HForm.Free;
Result:=Install;
end;