Counting timer in Borland Delphi[not entirely on-topic]
Hi,
I''m at the point where I''m going to implement timers in one of my programs, but the timer component that comes with delphi is not the right one. First, it uses events, which is not what I want, and secondley, I''ve heared from some peeps that it floods windows with timer-event messages.
Lingo, the language of Macromedia Director, has this handy timer, which you can start at a given moment in your program, and then it starts counting up for every second or whatever interval you said. So that you can later in your program retrieve how much seconds have been gone since you started the timer.
Does anyone know if there''s such a timer for Delphi? Possibly one that uses hardware directley, thus no delays or flooding with windows-messages?
Sorry for the long explanation for the small problem, and thanx for replying!
Newbie programmers think programming is hard.Amature programmers think programming is easy.Professional programmers know programming is hard.
Use the "GetTickCount" to get the time in msec since windows was started.
sumtin' like this:
1 StartTime := GetTickCount; (Sysutils.pas i think)
//Interval 1 sec = 1000ms
2 If GetTickCount => StartTime+1000 then
Increase "Clock" by one.. ( maybe Inc(Time,1) )
..and..do other stuff maybe..
Finally...Reset StartTime i.e "Goto 1".
Btw, getting timing info directly from hardware is tricky in windows, to say the least. It would prob. give you more trouble than effeciency.
/Ekas.
Edited by - Ekas78 on January 7, 2002 5:56:34 PM
sumtin' like this:
1 StartTime := GetTickCount; (Sysutils.pas i think)
//Interval 1 sec = 1000ms
2 If GetTickCount => StartTime+1000 then
Increase "Clock" by one.. ( maybe Inc(Time,1) )
..and..do other stuff maybe..
Finally...Reset StartTime i.e "Goto 1".
Btw, getting timing info directly from hardware is tricky in windows, to say the least. It would prob. give you more trouble than effeciency.
/Ekas.
Edited by - Ekas78 on January 7, 2002 5:56:34 PM
______________________________Only dead fish go with the main-stream.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement