[CustomMessages]
en.Aplay=&Play
en.Ainstall=&Install
en.AUnistall=&Uninstall
en.Aexit=&Exit

it.Aplay=&Gioca
it.AInstall=&Installa
it.AUnistall=&Disinstalla
it.Aexit=&Esci

es.Aplay=&Jugar
es.AInstall=&Instalar
es.AUnistall=&Desinstalar
es.Aexit=&Salida

de.Aplay=&Spielen
de.AInstall=&Installieren
de.AUnistall=&Deinstallieren
de.Aexit=&Ausfahrt

fr.Aplay=&Jouer
fr.AInstall=&Installer
fr.AUnistall=&Désinstaller
fr.Aexit=&Sortie

[code]
var HForm: TSetupForm;
    AbgImage : TBitmapImage;
    Button1,Button2,Button3: TNewButton;
    #ifdef AMusicLoop
    MLabel: TLabel;
    #endif
    MCIstr: PChar;
    Install: Boolean;

const
    AWidth= 563;
    AHeight= 403;
    SND_OPT= $1;

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\Codemasters\F1 2010',
     'PATH_APPLICATION', appath)
 if not Exec(appath+'f1_2010.exe', '', '', SW_SHOW,
     ewNoWait, ResultCode) then MsgBox(SysErrorMessage(ResultCode)+': f1_2010.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\Codemasters\F1 2010',
     'PATH_APPLICATION', appath)
     Exec((appath +'unins000.exe'), '', '', SW_SHOW,
      ewNoWait, ResultCode)
HForm.Close
Install:=False;
end;

#ifdef AMusicLoop
procedure MLabelOnClick(Sender: TObject);

begin
      PlaySound(expandConstant('{tmp}\Click.wav'),0,SND_OPT);
Case TLabel(sender).caption of
     'Background Music: On': begin
      mciSendString('PAUSE AMusicLoop', MCIstr, 255, 0);
      TLabel(sender).caption:='Background Music: Off';
      end;
      'Background Music: Off': begin
      mciSendString('PLAY AMusicLoop REPEAT', MCIstr, 255, 0);
      TLabel(sender).caption:='Background Music: On';
      end;
end;
end;
#endif

function LaunchAutorun: Boolean;

begin
#ifdef AMusicLoop
ExtractTemporaryFile('{#Autorunmp3filename}');
#endif
ExtractTemporaryFile('{#ClickSoundfilename}');
ExtractTemporaryFile('AutorunBGI.BMP');
HForm:=CreateCustomForm;

With HForm Do
Begin
ClientWidth:=AWidth;
ClientHeight:=AHeight;
Position := poScreenCenter;
BorderIcons := [biSystemMenu];
Caption:='{#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'));

Button1:=TNewButton.Create(HForm);
With Button1 Do
Begin
Parent:=HForm;
Left:= 150;
Top:=279;
Cursor:=crHand;
OnClick := @PIButtonOnClick;
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Codemasters\F1 2010') 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;
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Codemasters\F1 2010') 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;
end;

#ifdef AMusicLoop
MLabel:=TLabel.Create(HForm);
With MLabel Do
Begin
Parent:=HForm;
Transparent:=True;
Left:=450;
Top:=390;
Font.Color:=clWhite;
Width:=Button2.Width;
Height:=Button2.Height;
Caption:='Background Music: On';
Font.Name:='Arial';
Font.Style:=[fsBold];
Font.Size:= 7;
Cursor:=crHand;
OnClick := @MLabelOnClick;
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;

