inno-setup – Inno Setup卸载进度条更改事件

前端之家收集整理的这篇文章主要介绍了inno-setup – Inno Setup卸载进度条更改事件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在Inno Setup的Uninstall窗体中是否有任何事件/函数如CurInstallProgressChanged用于进度条和CurProgress和MaxProgress值?

解决方法

没有原生支持.

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

定时器也很棘手.同样,没有原生支持.您可以使用InnoTools InnoCallback DLL library.但是从卸载程序使用外部DLL库也很棘手.见(你的)Load external DLL for uninstall process in Inno Setup.

代码可能如下:

[Files]
Source: InnoCallback.dll; DestDir: {app}

[Code]

type
  TTimerProc = procedure(h: LongWord; Msg: LongWord; IdEvent: LongWord; dwTime: LongWord);

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 WrapTimerProc(Callback: TTimerProc; ParamCount: Integer): LongWord;
  external 'wrapcallback@{%TEMP}\innocallback.dll stdcall uninstallonly delayload';

function SetTimer(hWnd: LongWord; nIDEvent,uElapse: LongWord;
  lpTimerFunc: LongWord): LongWord;
  external 'SetTimer@user32.dll stdcall';

procedure InitializeUninstallProgressForm();
var
  TimerCallback: LongWord;
begin
  if FileCopy(ExpandConstant('{app}\innocallback.dll'),ExpandConstant('{%TEMP}\innocallback.dll'),False) then
  begin
    TimerCallback := WrapTimerProc(@TimerProc,4);
    SetTimer(0,100,TimerCallback); { every 100 ms }
  end;
end;

对于另一种解决方案(更好但实现起来更复杂),请参阅How keep uninstall files inside uninstaller?

原文链接:https://www.f2er.com/delphi/102985.html

猜你在找的Delphi相关文章