For Programmers: Free Programming Magazines  


Home > Archive > Visual Studio > April 2004 > When to call KillTimer()









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author When to call KillTimer()
Raj

2004-04-23, 3:44 pm

What is right place to kill timer that was created after receiving
WM_CREATE message for the window. TimerCallback is called at regular
timer intervals used in SetTimer().

WatchDogTimer = SetTimer(SharedData->g_hWnd, MY_WATCH_DOG_TIMER_ID,
WATCH_DOG_TIMEOUT, WatchDogTimerCallback);

I tried to call KillTimer before calling DestroyWindow(). Killtimer
returns error "message pending in queue". I tried to kill timer after
receiving WM_DESTROY. KillTimer then returns error = 2(file not
found). So tried to call KillTimer after quiting windows message loop
and it returns error 1440 = Invalid window handle. I didn't understand
where I should call Killtimer. I
Is it I should call only in Timer callback?

if(KillTimer(SharedData->g_hWnd, MY_WATCH_DOG_TIMER_ID) == 0)
{
Print("\n KillWatchDogTimer returns %ld \n",GetLastError());
}


Thanks.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com