Alexander Smith
Alexander Smith

Reputation: 379

Inno Setup uninstall progress bar change event

Is there any event/function like CurInstallProgressChanged for progressbar with CurProgress and MaxProgress values in Uninstall form in Inno Setup?

Upvotes: 1

Views: 822

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202262

There's no native support for this.

What you can do is to setup a timer and watch for changes in the UninstallProgressForm.ProgressBar.Position.

The code may be like:

[Code]

procedure TimerProc(
  h: LongWord; AMsg: LongWord; IdEvent: LongWord; dwTime: LongWord);
begin
  Log(Format(
    'Uninstall progress: %d/%d', [
      UninstallProgressForm.ProgressBar.Position,
      UninstallProgressForm.ProgressBar.Max]));
end;

function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord;
  lpTimerFunc: LongWord): LongWord;
  external '[email protected] stdcall';

procedure InitializeUninstallProgressForm();
begin
  SetTimer(0, 0, 100, CreateCallback(@TimerProc)); // every 100 ms
end;

For CreateCallback function, you need Inno Setup 6.

If you are stuck with Inno Setup 5, you can use WrapCallback function from InnoTools InnoCallback library (the code needs Unicode version of Inno Setup 5). But using an external DLL library from an uninstaller is tricky and has its drawbacks. See (yours) Load external DLL for uninstall process in Inno Setup. For another solution (better but more complicate to implement), see How keep uninstall files inside uninstaller?

Upvotes: 1

Related Questions