I hav set a timer using SetTimer(),after timeout my application gets a WM_TIMER and it exits.
I Want: to pause this timer before a particular process and again restart it when the process gets over,so tht there is no timeout during this process and my application doesnt exit during this process.how can i pause a timer and again restart it starting from the paused time.Plzzzzz help........

10 Years
Discussion Span
Last Post by Ancient Dragon

One way is to stop the timer before the process starts then restart it after it finished

KillTimer(hWnd, uIDEvent); // stop the timer
// Do some processing here
SetTimer( hWnd, uIDEvent, uElapse, lpTimerFunc); // restart timer

Thanks for the solution but the SetTimer() will again start the timer from 0 and not from the time where it was stopped.


Another solution is to set a global (or class) flag that indicates whether the timer function should do anything. If the flag is TRUE then the timer function should just return without doing anything. otherwise if FALSE then do whatever it would normally do.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.