Sunday, July 16, 2006

Time measuring without timers

GetTickCount (WinAPI)

The GetTickCount gives to you the number of miliseconds that have passed since this Windows session started.
If you have to cut an interval to compare if the time of execution in a function and the last time is between an interval you can use GetTickCount.


if (GettickCount - TimeOfLastExecution) < style="font-weight: bold;">then

This can be used to prevent errors when a critic code (that would consume more than 40% of CPU time) is triggered by user actions without the need to disable controls and enabling them after (what makes your code mess with the interface).

0 Comments:

Post a Comment

<< Home

Search in this blog:
Web DelphiEArte.blogspot.com
ip-location