Inno Setup 卸载进度条变化事件

Inno Setup uninstall progress bar change event

在 Inno Setup 的卸载表单中,进度条是否有 event/function 之类的 CurInstallProgressChangedCurProgressMaxProgress 值?

没有对此的本机支持。

你可以做的是设置一个计时器并观察 UninstallProgressForm.ProgressBar.Position 中的变化。

代码可能是这样的:

[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;

对于 CreateCallback function,您需要 Inno Setup 6。

如果您受困于 Inno Setup 5,您可以使用 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) . For another solution (better but more complicate to implement), see How keep uninstall files inside uninstaller?

中的 WrapCallback 函数