Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is GetTickCount after Delphi 6?

Tags:

delphi

indy

I am trying to migrate from Delphi 6 to Delphi 2010, but I cannot find the GetTickCount function in Delphi 2010. I have IdGlobal, SysUtils, and DateUtils in my uses clause.

var
  RefreshTick : Cardinal;
begin
  RefreshTick := GetTickCount;
end;

It gives me an error:

Undeclared identifier : GetTickCount

What's an alternative to this?

like image 250
Shirish11 Avatar asked Dec 07 '22 18:12

Shirish11


2 Answers

The GetTickCount function is part of the Windows unit.

like image 183
RRUZ Avatar answered Dec 20 '22 03:12

RRUZ


As you've since discovered, the GetTickCount function you were using was provided by the IdGlobal unit. It had the same name as a Windows API function. The function you were using is now named Ticks. Either add Windows to your uses clause to get the API function, or change your code to use the new name instead.

It looks like the name change came sometime in 2004. You should try to be more diligent about keeping your Indy library up to date. Don't just use the version that comes with Delphi — it was probably outdated before you even got it. Always download the latest version from Indy's source control.

like image 37
Rob Kennedy Avatar answered Dec 20 '22 01:12

Rob Kennedy