#define TIME_FOR_VIEW 10 [Setup] AppName=My Program AppVerName=My Program v 1.5 DefaultDirName={pf}\My Program OutputDir=. Compression=lzma/ultra SolidCompression=yes [Languages] Name: russian; MessagesFile: compiler:Languages\Russian.isl [Files] Source: InnoCallback.dll; Flags: dontcopy noencryption nocompression solidbreak; Source: *.bmp; Flags: dontcopy noencryption nocompression solidbreak; Source: D:\Games\StarCraft enGB\StarDat.mpq; DestDir: {app} [code] const n=21; //количество слайдов type TProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord); TRandNumbers = array[1..N] of byte; 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 get_unique_random_number(X:byte):TRandNumbers; var A,b,c: string; i,j,k:byte; begin For i:=1 to X do A:=A+chr(i); B:=''; For i:=1 to X do begin j:=Random(Length(A)-1)+1; C:=''; B:=B + A[j]; for k:=1 to Length(A) do if k<>j then C:=C+A[k]; A:=C; end; for i:=1 to X do Result[i]:=ord(B[i]); end; var TimerID: LongWord; currTime: Integer; SplashImage: TBitmapImage; StatusMessages: TNewStaticText; bmp: TRandNumbers; z:byte; procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord); begin currTime := currTime + 1; if (currTime mod {#TIME_FOR_VIEW} = 0) then begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_'+inttostr(bmp[currTime/{#TIME_FOR_VIEW}])+'.bmp')); if (currTime/{#TIME_FOR_VIEW} = N) then currTime:=0; end; end; procedure InitializeWizard; begin bmp:=get_unique_random_number(N); ExtractTemporaryFile('Image_'+inttostr(bmp[1])+'.bmp'); currTime := 0; WizardForm.ProgressGauge.Parent := WizardForm; WizardForm.ProgressGauge.Top := WizardForm.CancelButton.Top + ScaleY(12); WizardForm.ProgressGauge.Left := ScaleX(10); WizardForm.ProgressGauge.Width := WizardForm.MainPanel.Width - ScaleX(20); WizardForm.ProgressGauge.Height := 16; WizardForm.ProgressGauge.Hide; WizardForm.StatusLabel.Parent := WizardForm; WizardForm.StatusLabel.Top := WizardForm.ProgressGauge.Top - ScaleY(18); WizardForm.StatusLabel.Left := ScaleX(10); WizardForm.StatusLabel.Width := ScaleX(397); WizardForm.StatusLabel.Hide; SplashImage := TBitmapImage.Create(WizardForm); SplashImage.Top := 0; SplashImage.Left := 0; SplashImage.Width := WizardForm.MainPanel.Width; SplashImage.Height := WizardForm.Bevel.Top; SplashImage.Parent := WizardForm.InnerPage; SplashImage.Stretch := True; SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_'+inttostr(bmp[1])+'.bmp')); SplashImage.Hide; end; procedure CurStepChanged(CurStep: TSetupStep); begin if CurStep = ssInstall then begin WizardForm.StatusLabel.Caption := 'Распаковка слайдов ...'; for z:=2 to N do ExtractTemporaryFile('Image_'+inttostr(bmp[z])+'.bmp'); end; end; procedure CurPageChanged(CurPageID: Integer); var pfunc: LongWord; begin if (CurPageID = wpInstalling) then begin pfunc := WrapTimerProc(@OnTimer, 5); TimerID := SetTimer(0, 0, 1000, pfunc); WizardForm.PageNameLabel.Visible := False; WizardForm.PageDescriptionLabel.Visible := False; WizardForm.InnerNotebook.Hide; WizardForm.Bevel1.Hide; WizardForm.MainPanel.Hide; WizardForm.PageNameLabel.Hide; WizardForm.PageDescriptionLabel.Hide; WizardForm.ProgressGauge.Show; WizardForm.StatusLabel.Show; SplashImage.Show; WizardForm.CancelButton.Enabled := True; WizardForm.CancelButton.Top := WizardForm.Bevel.Top + ScaleY(100); end else begin WizardForm.ProgressGauge.Hide; SplashImage.Hide; WizardForm.FileNameLabel.Hide; WizardForm.StatusLabel.Hide; if (CurPageID > wpInstalling) and (CurPageID < wpFinished) then begin WizardForm.InnerNotebook.Show; WizardForm.Bevel1.Show; WizardForm.MainPanel.Show; WizardForm.PageNameLabel.Show; WizardForm.PageDescriptionLabel.Show; end; If CurPageID = wpFinished then end; end; procedure DeInitializeSetup(); begin KillTimer(0, TimerID); end;
|