How to reset Timers
-
Hi, Can I reset a Timer without doing a KillTimer? For example if I created a Timer as oldTimer = SetTimer(0, 2000, NULL); later SetTimer(oldTimer, 5000, NULL); Is this going to reset the Timer to the new time. Thanks, gc
-
Hi, Can I reset a Timer without doing a KillTimer? For example if I created a Timer as oldTimer = SetTimer(0, 2000, NULL); later SetTimer(oldTimer, 5000, NULL); Is this going to reset the Timer to the new time. Thanks, gc
It has been a while since I played around with them but I'm pretty sure that if you try SetTimer as you suggested, the second one will fail since the timer with the given id has already been allocated. You can check the return value for yourself to be sure though.
-
Hi, Can I reset a Timer without doing a KillTimer? For example if I created a Timer as oldTimer = SetTimer(0, 2000, NULL); later SetTimer(oldTimer, 5000, NULL); Is this going to reset the Timer to the new time. Thanks, gc
From MSDN:
If the hWnd parameter is not NULL and the window specified by hWnd already has a timer with the value nIDEvent, then the existing timer is replaced by the new timer. When SetTimer replaces a timer, the timer is reset. Therefore, a message will be sent after the current time-out value elapses, but the previously set time-out value is ignored.
So there's no need to "reset" a timer (which you can't actually do anyway, you can only create it or kill it). --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--= NO CARRIER
-
From MSDN:
If the hWnd parameter is not NULL and the window specified by hWnd already has a timer with the value nIDEvent, then the existing timer is replaced by the new timer. When SetTimer replaces a timer, the timer is reset. Therefore, a message will be sent after the current time-out value elapses, but the previously set time-out value is ignored.
So there's no need to "reset" a timer (which you can't actually do anyway, you can only create it or kill it). --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--= NO CARRIER