Click to See Complete Forum and Search --> : Is there a limit to how long WM_TIMER messages will fire for?


April 6th, 1999, 05:21 AM
I am setting a timer using the window's SetTimer function and handling the message in the window's OnTimer handler. This seems to work fine for a while. However, I wish the timer to be active indefinately and after a few days it appears to no longer be signalling.
Is there a limit on how long the timer will keep firing?

Dave Lorde
April 6th, 1999, 05:32 AM
I believe timers use an unsigned int for the timeout value with a maximum value (in 32 bit systems) of 4294967295 ms. Assuming a value of zero gives you the maximum timeout (rather than an infinite timeout), this should run for about 49 days...

Dave

April 6th, 1999, 05:42 AM
If the timeout value is set to say 10 minutes, will this fire every ten minutes indefinitely though? Or is there a limit on how long the timer will keep firing?

Dave Lorde
April 6th, 1999, 05:53 AM
Oh, right, I see your point. Um, I don't know, the MSDN timer docs don't say. I would expect them to keep on going; we have a monitoring application using timers in VB which have kept going for weeks (or we'd get complaints!).

Timers are a limited resource, and if too many are used, I don't know what happens...

Dave

Bernhard Dreyer
April 6th, 1999, 09:05 AM
If you want to be sure that your timer(s) are running till eternity, kill the
timer in the OnTimer() funktion and start the timer new.

That's what I do and it works well.

By looking at some samples it seems that even MS kills the timers.....

unhuman
April 8th, 1999, 04:00 PM
It seems like you know what you are doing and I posted this elsewhere, but have gotten no responses:

Is there a way to determine which timers (by ID) are active without keeping track of them myself?

Thanks - H

-
Howard Uman - unHUman Software
http://www.unhuman.com
human@unhuman.com

Dave Lorde
April 9th, 1999, 03:57 AM
> Is there a way to determine which timers (by ID) are active without keeping track of them myself?

Possibly, I don't know, but I'd track 'em myself if I were you.

Dave

Oak
April 9th, 1999, 05:50 AM
Using of SetTimer function sometimes is not very good idea as it just
posts message WM_TIMER to window queue and if there is already such a message in the
queue it doest posts it. So for long time intervals such a method doest work precisely.
Better use callback functions.
Anyway if u r using WM_TIMER make sure that
u r properly kill timers as windows have limited
number of timers.