PDA

Click to See Complete Forum and Search --> : SetTimer/KillTimer


Technocrat
Feb 8th, 2001, 11:41 AM
I am having a problem killing a timer I have set

I set the timer with:

m_TimerID = SetTimer(m_hWnd,1,5000,(TIMERPROC)TimerProc);


And I have tried both of the following to kill the timer

BOOL ret;

ret = KillTimer(m_hWnd,1);
ret = KillTimer(m_hWnd,m_TimerID);


Neither one seems to kill the timer, and the both return false. Any ideas on what I am doing wrong or how to kill the timer?

Thanks

Jop
Feb 8th, 2001, 01:38 PM
According to MS this should work:


ret = KillTimer(NULL, m_TimerID);


Where m_TimerID is the Timer ID you received from the SetTimer function

Or


ret = KillTimer(m_hWnd,1);


Where 1 is the Timer ID (I see you use 1 in the SetTimer too)

Technocrat
Feb 8th, 2001, 03:07 PM
I figured it out. My window handle was no inited yet so it was 0x00000000 in the SetTimer function and 0x0000da16 in the KillTimer. So I just set the kill and set to the same handle and it works now. Thanks for the help.