Displaying multiple images (slide shows) on the wp setup page under the ProgressGauge panel in Inno Setup

I prepared a simple script that displays the image under the ProgressGauge on the wpInstalling page.

But ... I need more sophisticated functionality.

I need to show several images, each after X (for example, 7) seconds (with a cycle during installation longer than X seconds * number of images) or each after X (for example, 10) percent of the installation. I tried to enable image display in ProgressGauge.Position , but I failed.

Here is what I have:

 procedure CurPageChanged(CurPageID: Integer); var BmpFile: TBitmapImage; begin ExtractTemporaryFile('01.bmp'); ExtractTemporaryFile('02.bmp'); ExtractTemporaryFile('03.bmp'); if CurPageID = wpInstalling then begin BmpFile:= TBitmapImage.Create(WizardForm); BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\01.bmp')); BmpFile.Width:= ScaleX(420); BmpFile.Height:= ScaleY(180); BmpFile.Left := WizardForm.ProgressGauge.Left + ScaleX(0); BmpFile.Top := WizardForm.ProgressGauge.Top + ScaleY(35); // BmpFile.Parent:= WizardForm.InstallingPage; // BmpFile:= TBitmapImage.Create(WizardForm); // BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\03.bmp')); // BmpFile.Width:= ScaleX(420); // BmpFile.Height:= ScaleY(400); // BmpFile.Left := WizardForm.ProgressGauge.Left + ScaleX(0); // BmpFile.Top := WizardForm.ProgressGauge.Top + ScaleY(35); // BmpFile.Parent:= WizardForm.InstallingPage; // BmpFile:= TBitmapImage.Create(WizardForm); // BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\03.bmp')); // BmpFile.Width:= ScaleX(420); // BmpFile.Height:= ScaleY(400); // BmpFile.Left := WizardForm.ProgressGauge.Left + ScaleX(0); // BmpFile.Top := WizardForm.ProgressGauge.Top + ScaleY(35); // BmpFile.Parent:= WizardForm.InstallingPage; end; end; 

Goal:
On wpInstalling , X images should be displayed, each following X seconds or after X percent of the installation.

+7
source share
2 answers

Since ProgressGauge has no progress change events and there is no way to process installation application messages, you will need to use the Windows Timer API. This timer needs a callback function that you cannot define in the Inno Setup script, unfortunately, for this you will need an external library to perform this task. However, there is an InnoCallback library that can do just that.

For the following code, copy the InnoCallback.dll library into your installation directory, merge this code using the Inno Setup script and execute some page of the slide show into the OnSlideTimer event, which will be called periodically (with the current settings every second).

 [Files] Source: "InnoCallback.dll"; DestDir: "{tmp}"; Flags: dontcopy [code] var TimerID: Integer; type TTimerProc = procedure(Wnd: HWND; Msg: UINT; TimerID: UINT_PTR; SysTime: DWORD); function WrapTimerProc(Callback: TTimerProc; ParamCount: Integer): LongWord; external ' wrapcallback@files :InnoCallback.dll stdcall'; function SetTimer(hWnd: HWND; nIDEvent, uElapse: UINT; lpTimerFunc: UINT): UINT; external ' SetTimer@user32.dll stdcall'; function KillTimer(hWnd: HWND; uIDEvent: UINT): BOOL; external ' KillTimer@user32.dll stdcall'; procedure OnSlideTimer(Wnd: HWND; Msg: UINT; TimerID: UINT_PTR; SysTime: DWORD); begin { here you can turn your slideshow pages; use some variable to store the } { current index of the slide you are on, note that this procedure is called } { periodically each 1000 ms (see below why), so here you can also check the } { progress value, if you want to } end; procedure StartSlideTimer; var TimerCallback: LongWord; begin TimerCallback := WrapTimerProc(@OnSlideTimer, 4); { third parameter here is the timer timeout value in milliseconds } TimerID := SetTimer(0, 0, 1000, TimerCallback); end; procedure KillSlideTimer; begin if TimerID <> 0 then begin if KillTimer(0, TimerID) then TimerID := 0; end; end; function InitializeSetup: Boolean; begin Result := True; TimerID := 0; end; procedure DeinitializeSetup; begin KillSlideTimer; end; procedure CurPageChanged(CurPageID: Integer); begin if CurPageID = wpInstalling then StartSlideTimer else KillSlideTimer; end; 
+8
source

Why not use AfterInstall for each file entry to change the image?

+2
source

Source: https://habr.com/ru/post/913070/


All Articles