Multiple images display (slideshow) on wpInstalling Page under ProgressGauge bar in Inno Setup

Since the ProgressGauge has no progress change events and there is no way to process setup application messages you will need to use the Windows API timer. This timer needs a callback function which you can’t define in Inno Setup script unfortunately so you will need some external library to do this job for you. However there’s the InnoCallback library which can do exactly this.

For the following code copy the InnoCallback.dll library into your setup directory, merge this code with your Inno Setup script and implement some kind of a slideshow page turning in the OnSlideTimer event which will be called periodically (with the current settings each 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 '[email protected] stdcall';
function KillTimer(hWnd: HWND; uIDEvent: UINT): BOOL; 
  external '[email protected] 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's 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;

Leave a Comment