Raf_SE
Advanced Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору [Code] type TProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord); var Form : TSetupForm; BackImage, SlideImage: TBitmapImage; TimerID: LongWord; S : String; Width, Height:Integer; function WrapTimerProc(callback:TProc; paramcount:integer):longword; external 'wrapcallback@files:innocallback.dll stdcall'; function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord): LongWord; external 'SetTimer@user32.dll stdcall'; function KillTimer(hWnd: LongWord; nIDEvent: LongWord): LongWord; external 'KillTimer@user32.dll stdcall'; function GetSystemMetrics(nIndex:Integer):Integer; external 'GetSystemMetrics@user32.dll stdcall'; function PercentProgress(): Integer; begin with WizardForm.ProgressGauge do begin Result:=(Position-Min)/((Max - Min)/100) end end; procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord); var Percent: Integer; begin Percent:= PercentProgress; with SlideImage do begin if ((percent>0) and (percent<10) and (Tag<>1)) then begin Bitmap.LoadFromFile(ExpandConstant('{tmp}') + '\bilboard0.bmp') Tag:=1 end else if ((percent>11) and (percent<22) and (Tag<>2)) then begin Bitmap.LoadFromFile(ExpandConstant('{tmp}') + '\bilboard1.bmp') Tag:=2 end else if ((percent>23) and (percent<33) and (Tag<>3)) then begin Bitmap.LoadFromFile(ExpandConstant('{tmp}') + '\bilboard2.bmp') Tag:=3 end else if ((percent>34) and (percent<44) and (Tag<>4)) then begin Bitmap.LoadFromFile(ExpandConstant('{tmp}') + '\bilboard3.bmp') Tag:=4 end else if ((percent>45) and (percent<55) and (Tag<>5)) then begin Bitmap.LoadFromFile(ExpandConstant('{tmp}') + '\bilboard4.bmp') Tag:=5 end else if ((percent>56) and (percent<66) and (Tag<>6)) then begin Bitmap.LoadFromFile(ExpandConstant('{tmp}') + '\bilboard5.bmp') Tag:=6 end else if ((percent>67) and (percent<77) and (Tag<>7)) then begin Bitmap.LoadFromFile(ExpandConstant('{tmp}') + '\bilboard6.bmp') Tag:=7 end else if ((percent>78) and (percent<88) and (Tag<>8)) then begin Bitmap.LoadFromFile(ExpandConstant('{tmp}') + '\bilboard7.bmp') Tag:=8 end else if ((percent>89) and (percent<100) and (Tag<>9)) then begin Bitmap.LoadFromFile(ExpandConstant('{tmp}') + '\bilboard8.bmp') Tag:=9 end end end; procedure InitializeWizard(); begin WizardForm.Position:= poScreenCenter; Width:= GetSystemMetrics(0); Height:= GetSystemMetrics(1); MainForm.BorderStyle:= bsNone; MainForm.Left:= 0; MainForm.Top:= 0; MainForm.Width:= Width; MainForm.Height:= Height; ExtractTemporaryFile('BackImage.bmp'); S:= (ExpandConstant('{tmp}')+'\BackImage.bmp'); BackImage:=TBitmapImage.Create(MainForm); BackImage.Bitmap.LoadFromFile(S); BackImage.Align:= alClient; BackImage.Parent:= MainForm; BackImage.Stretch:= True; MainForm.Visible:= True; ExtractTemporaryFile('BackImage.bmp'); ExtractTemporaryFile('bilboard0.bmp'); ExtractTemporaryFile('bilboard1.bmp'); ExtractTemporaryFile('bilboard2.bmp'); ExtractTemporaryFile('bilboard3.bmp'); ExtractTemporaryFile('bilboard4.bmp'); ExtractTemporaryFile('bilboard5.bmp'); ExtractTemporaryFile('bilboard6.bmp'); ExtractTemporaryFile('bilboard7.bmp'); ExtractTemporaryFile('bilboard8.bmp'); end; procedure CurPageChanged(CurPageID: Integer); var Pfunc : LongWord; begin If CurPageID = wpInstalling then begin Form := CreateCustomForm(); Form.ClientWidth := ScaleX(800); Form.ClientHeight := ScaleY(600); Form.Width:= 800; Form.Height:= 600; Form.BorderStyle := bsNone; Form.Color:=clBlack; Form.Parent:=MainForm; Form.Position:=poScreenCenter; Form.Show(); pfunc:=WrapTimerProc(@OnTimer, 4) TimerID:=SetTimer(0, 0, 500, pfunc) S:= (ExpandConstant('{tmp}') + '\bilboard0.bmp'); SlideImage:= TBitmapImage.Create(Form); with SlideImage do begin Align:= alClient; Stretch:= True; Bitmap.LoadFromFile(S); Parent:= Form; Tag:= 1; end with WizardForm do begin MainPanel.Hide; Bevel1.Hide; Width:= ScaleX(395); Height:= ScaleY(142); Left:= ScaleX(0); Top:= ScaleY(0); Left:= ScaleX(MainForm.Left+20); Top:= ScaleY(MainForm.Height-170); InnerNotebook.Left:= ScaleX(10); InnerNotebook.Top:= ScaleY(10); InnerNotebook.Width:= ScaleX(370); StatusLabel.Left:= ScaleX(0); StatusLabel.Top:= ScaleY(0); StatusLabel.Width:= WizardForm.InnerNotebook.Width; FileNameLabel.Left:= ScaleX(0); FileNameLabel.Top:= ScaleY(20); FileNameLabel.Width:=WizardForm.InnerNotebook.Width; ProgressGauge.Top:= ScaleY(40); ProgressGauge.Width:= WizardForm.InnerNotebook.Width; CancelButton.BringToFront; CancelButton.Left:= ScaleX(154); CancelButton.Top:= ScaleY(80); end end begin if CurPageID = wpFinished then begin Form.Free; KillTimer(0, TimerID); WizardForm.Width:=502; WizardForm.Height:=392; WizardForm.Position:=poScreenCenter; end end end; procedure DeinitializeSetup(); begin KillTimer(0, TimerID); end; procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); var Res: Integer; begin case CurUninstallStep of usPostUninstall: begin If DirExists(ExpandConstant('{app}')+'') then case MsgBox('Папка "'+ExpandConstant('{app}')+'" не пуста.'#13#13 + '"Да" – полное удаление всех файлов в папке, включая саму папку.' #13#13 + '"Нет" – открыть папку в проводнике, чтобы вручную удалить файлы.'#13#13 + '"Отмена" – ничего не делать, удалить папку позже самостоятельно.', mbInformation, MB_YESNOCANCEL) of IDYES: begin if not DelTree(ExpandConstant('{app}')+'', True, True, True) then MsgBox('Папка не удалена.' #13#13 'Папка или один из файлов в ней задействованы другим приложением.', mbError, MB_OK); end IDNO: begin if not ShellExec('open', ExpandConstant('{app}')+'', '', '', SW_SHOWMAXIMIZED, ewNoWait, Res) then MsgBox('Ошибка открытия.' #13#13 'Папка не найдена.', mbError, MB_OK); end IDCANCEL: begin Form.Close; end end end end end; function NextButtonClick(CurPage: Integer): Boolean; var s2:string; begin Result:=True; If CurPage = wpSelectDir then begin s2:= (ExpandConstant('{app}') + ''); If DirExists(s2) then begin s:= 'Установка в существующую папку в целях безопасности невозможна!'; MsgBox(s, mbError, mb_Ok); Result:=False; end end end; procedure CurStepChanged(CurStep: TSetupStep); begin if CurStep = ssPostInstall then begin RegWriteBinaryValue(HKLM, 'Software\Illusion Softworks\Mafia', 'idir', ExpandConstant('{app}')); end end; | Всего записей: 1143 | Зарегистр. 06-08-2006 | Отправлено: 19:30 03-03-2008 | Исправлено: Raf_SE, 19:36 03-03-2008 |
|