如何在 Inno Setup 中指定更新剩余时间标签的时间段?

How to specify the period during which the remaining-time-label is updated in Inno Setup?

我想像下面的问题一样在安装过程中显示剩余时间,并使用了那里的代码,由 TLama 发布:How to show percent done, elapsed time and estimated time progress?

代码对我有用,非常感谢。 但是如果你安装更大的文件,"remaining-time-label"更新的周期太快了。

所以我想问一下,如何改变"remaining-time-label"的更新周期,让它只更新一秒或半秒。

提前致谢

使用GetTickCount记住最后更新时间。在下一次调用 CurInstallProgressChanged 时计算与 CurTick 的差异并仅在差异足够大时更新标签(1000 = 1 秒)

var
  LastUpdate: DWORD;

procedure CurInstallProgressChanged(CurProgress, MaxProgress: Integer);
var
  CurTick: DWORD;
begin
  CurTick := GetTickCount;
  if (CurTick - LastUpdate) >= 1000 then
  begin
    LastUpdate := CurTick;
    // Update labels
  end;
end;