0

I wanted to show remaining time during an installation like in the following question and used the code from there, posted by TLama: How to show percent done, elapsed time and estimated time progress?

The code is working for me, so thanks for this. But if you install bigger files, the period in which the "remaining-time-label" is updated, is too fast.

So I wanted to ask, how to change the update period of the "remaining-time-label", so that it updates only every second or every half second.

Thanks in advance

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992

1 Answers1

0

Use GetTickCount to remember the last update time. On the next calls to CurInstallProgressChanged calculate difference to CurTick and update the labels only if the difference is large enough (1000 = 1 second)

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;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992