|
-
May 3rd, 1999, 03:49 PM
#1
Help to Kill Timer
Hi,
I need your help !!
I'd like to use SetTimer with CALLBACK FUNCTION like 3rd parameter in SetTimer
I try this
::SetTimer(NULL, 1, 1000, CMyFrame::TimerProc) in CMainFrame
It's working, but I have a problem with KillTimer function. I can't stop Timer.
Please help me. What must I do. And how can I call KillTimer corectlly.
Thank you in advance
Drago
-
May 3rd, 1999, 03:59 PM
#2
Re: Help to Kill Timer
So when you're calling KillTimer, you're doing it exactly like this?:KillTimer( NULL, 1 );
Is that right? When you initialized the timer, you didn't give it a parent window, instead you told it "NULL", and in doing that, you must call the corresponding KillTimer routine with "NULL" in the first parameter (which would have been a window handle)..
Is that the way you're calling KillTimer?
- Troy
-
May 3rd, 1999, 04:47 PM
#3
Re: It's right but..
Thank you for answer but
I have't any open views and if I use SetTimer(1,100, NULL) I can't set timer on.
Please tell me how can I use a handle to window like 3rd parameter.
Thank you very much
Drago
-
May 4th, 1999, 12:51 AM
#4
Re: It's right but..
I wasn't referring to how you're setting the timer, but how you're killing it. You must be consistant in how you're setting and killing the timer. If you use a HWND in one, you need to use that same HWND in the other. Be consistant. 
- Troy
-
May 5th, 1999, 01:00 PM
#5
More information
Hi,
Here is my all problem:
I use MDI application. I'd like to swich on my timer in CMainFrame and I'd like stop this timer in same class (CMainFrame)
Now I just use this:
SetTimer(NULL, 1, 1000, TimerProc)
TimerProc is defined like EXTERN CALLBACK function
and I kill timer like that:
KillTimer(NULL, 1)
But there is a problem with KillTimer. When I call KillTimer, this function return FALSE.
What can I do .
Please help me!
Thanks a lot.
Drago
-
May 5th, 1999, 04:17 PM
#6
Re: More information
After reading all of the help files in MSDN about the Set/Kill Timer fuctions, the only thing I get think of is for you to call GetLastError() and see what the specific problem is with the KillTimer function call.. Sorry I couldn't be much help afterall, I thought for sure that I noticed your HWND's were different, and that it was the reason the call failed.
Good luck.
- Troy
-
May 6th, 1999, 02:42 PM
#7
Thanks for everything
Thank you very much.
Good Luck Troy.
Drago
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|