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

时间:2015-09-26 08:55:05

标签: time inno-setup pascalscript

我希望在安装过程中显示剩余时间,例如以下问题,并使用TLama发布的代码:How to show percent done, elapsed time and estimated time progress?

代码对我有用,所以谢谢你。 但是如果你安装更大的文件,那么"剩余时间标签"更新,太快了。

所以我想问一下,如何更改"剩余时间标签"的更新周期,以便它每隔一秒或每半秒更新一次。

提前致谢

1 个答案:

答案 0 :(得分:0)

使用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;