Scenario:
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........

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.