Inno Setup uninstall progress bar change event

前端 未结 1 1982
暗喜
暗喜 2021-01-07 14:25

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

相关标签:
1条回答
  • 2021-01-07 14:54

    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 'SetTimer@user32.dll 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?

    0 讨论(0)
提交回复
热议问题