On (16 May 97) Neil Heller wrote to Jerry Coffin...
JC> I'd _strongly_ advise doing this considerably differently. I'd
JC> use something more like:
JC>
JC> void CALLBACK TimerProc(HWND wnd, UINT, UINT timer, DWORD) {
JC> KillTimer(wnd, timer); // The timer will continue to fire
JC> // every minute unless we kill it.
NH> I currently use my method in a much larger loop inside a comm. program
NH> while I'm waiting for modems to hash. There is quite a bit of
NH> processing going in the loop besides just time polling.
In this case, you may not gain a great deal from the change (other than
reasonably accurate timing) but you can typically get by with simply
setting a flag in your timer proc, and checking the flag in your loop.
Under Win32, you might want to consider doing your processing in a
separate thread, and simply killing the thread if the time expires.
There are quite a few more possibilities, but without knowing what
processing you're doing and what you need to accomplish, it's hard to
say what makes the most sense.
NH> One question though. How does the timer itself get the time?
Windows installs a handler on the timer interrupt (as well as almost
every other interrupt in the system...)
Later,
Jerry.
... The Universe is a figment of its own imagination.
--- PPoint 1.90
---------------
* Origin: Point Pointedly Pointless (1:128/166.5)
|