ChanVS
Junior Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору [Setup] AppName=AutoRUN VersionInfoDescription=AutoRUN VersionInfoProductName=AutoRUN AppVerName=AutoRUN VersionInfoProductVersion=1.0.0.0 VersionInfoVersion=1.0.0.0 VersionInfoCompany=john VersionInfoCopyright=Copyright © John CreateAppDir=no OutputDir=. OutputBaseFilename=Autorun SetupIconFile=Icon.ico [Languages] Name: Russian; MessagesFile: compiler:Default.isl [Files] Source: 1.bmp; Flags: dontcopy [Messages] SetupAppTitle=AutoRUN [Code] const BM_CLICK = $00F5; var AutoRun: TSetupForm; img1: TBitmapImage; PlayButton, InstallButton, SupportButton, ReadmeButton, WebButton, ExitButton, UninstallButton: TButton; AppPath,UninsPath: string; ResultCode: Integer; procedure CurPageChanged(CurPageID: Integer); begin If CurPageID=wpWelcome then SendMessage(WizardForm.NextButton.Handle, BM_CLICK, 0, 0); end; procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean); begin Confirm:=False Cancel:=True end; procedure PlayButtonClick(Sender: TObject); var exe: string; begin exe:='shift.exe'; if RegQueryStringValue(HKLM, 'SOFTWARE\Electronic Arts\Game','Install Dir', AppPath) then begin Exec(AddBackslash(AppPath) + Exe, '', ExtractFilePath(AddBackslash(AppPath) + Exe), SW_SHOWNORMAL,ewNoWait,ResultCode) AutoRun.Close; PostMessage(WizardForm.CancelButton.Handle, BM_CLICK, 0, 0); end end; procedure InstallButtonClick(Sender: TObject); var CurPageID: Integer; begin Exec(ExpandConstant('{src}\Setup.exe'),'','',SW_SHOW,ewNoWait,ResultCode) AutoRun.Close; PostMessage(WizardForm.CancelButton.Handle, BM_CLICK, 0, 0); end; procedure SupportButtonClick(Sender: TObject); begin shellexec('open', ExpandConstant('{src}\Game.exe'), '', '',SW_SHOWNORMAL, ewnowait, ResultCode) end; procedure ReadmeButtonClick(Sender: TObject); begin ShellExec('open', ExpandConstant('{src}\readme.txt'),'','', SW_SHOW, ewNoWait, ResultCode) end; procedure WebButtonClick(Sender: TObject); begin shellexec('open', 'http://localhost', '', '',SW_SHOWNORMAL, ewnowait, ResultCode) end; procedure ExitButtonClick(Sender: TObject); var CurPageID: Integer; begin AutoRun.Close; PostMessage(WizardForm.CancelButton.Handle, BM_CLICK, 0, 0); end; procedure UninstallButtonClick(Sender: TObject); begin if RegQueryStringValue(HKLM, 'SOFTWARE\Game','UninstallString', UninsPath) then begin UninsPath:=RemoveQuotes(UninsPath) Exec(UninsPath,'','',SW_SHOWNORMAL,ewNoWait,ResultCode) AutoRun.Close; PostMessage(WizardForm.CancelButton.Handle, BM_CLICK, 0, 0); end end; procedure CreateAutoRun; begin //AutoRun AutoRun := CreateCustomForm; with AutoRun do begin Left := 498; Top := 75; Width := 495; Height := 340; BorderIcons := []; BorderStyle:=bsToolWindow //(bsNone, bsSingle, bsSizeable, bsDialog, bsToolWindow, bsSizeToolWin) Color := clBtnFace; Font.Color := clWindowText; Font.Height := -11; Font.Name := 'MS Sans Serif'; Font.Style := []; Position := poScreenCenter; Caption:='AutoRUN' end; //img1 img1 := TBitmapImage.Create(AutoRun); ExtractTemporaryFile('1.bmp'); with img1 do begin Parent := AutoRun; Left := 0; Stretch:= true; Top := 0; Width := Autorun.Width; Height := Autorun.Height; Bitmap.LoadFromFile(ExpandConstant('{tmp}\1.bmp')); end; //PlayButton PlayButton:= TButton.Create(AutoRun); with PlayButton do begin Parent := AutoRun; Left := 300; Top := 110; Width := 150; Height := 22; Caption:= 'Начать игру'; Cursor:= crHand; // ModalResult:= mrOk; OnClick := @PlayButtonClick; if not RegQueryStringValue(HKLM, 'SOFTWARE\Game','Install Dir', AppPath) then begin PlayButton.Enabled := False; end end; //InstallButton InstallButton:= TButton.Create(AutoRun); with InstallButton do begin Parent:= AutoRun; Left := 300; Top := 80; Width := 150; Height := 22; Caption:= 'Install Game'; Cursor:= crHand; OnClick := @InstallButtonClick; end; //SupportButton SupportButton:= TButton.Create(AutoRun); with SupportButton do begin Parent:= AutoRun; Left := 300; Top := 140; Width := 150; Height := 22; Caption:= 'Инфо'; Cursor:= crHand; OnClick := @SupportButtonClick; end; //ReadmeButton ReadmeButton:= TButton.Create(AutoRun); with ReadmeButton do begin Parent:= AutoRun; Left := 300; Top := 170; Width := 150; Height := 22; Caption:= 'Readme'; Cursor:= crHand; OnClick := @ReadmeButtonClick; end; //WebButton WebButton:= TButton.Create(AutoRun); with WebButton do begin Parent:= AutoRun; Left := 300; Top := 200; Width := 150; Height := 22; Caption:= 'Веб-сайт'; Cursor:= crHand; OnClick := @WebButtonClick; end; //ExitButton ExitButton:= TButton.Create(AutoRun); with ExitButton do begin Parent:= AutoRun; Left := 300; Top := 260; Width := 150; Height := 22; Caption:= 'Выход'; Cursor:= crHand; OnClick := @ExitButtonClick; // ModalResult:= mrCancel; end; //UninstallButton UninstallButton:= TButton.Create(AutoRun); with UninstallButton do begin Parent:= AutoRun; Left := 300; Top := 230; Width := 150; Height := 22; Caption:= 'Удалить игру'; Cursor:= crHand; OnClick := @UninstallButtonClick; end; if not RegQueryStringValue(HKLM, 'SOFTWARE\Game','UninstallString', UninsPath) then begin InstallButton.Enabled:=true; UninstallButton.Enabled:=false; end; if RegQueryStringValue(HKLM, 'SOFTWARE\Game','UninstallString', UninsPath) then begin InstallButton.Enabled:=false; UninstallButton.Enabled:=true; end; AutoRun.ShowModal; end; procedure InitializeWizard; begin CreateAutoRun; end; |