-
August 5th, 2009, 01:00 PM
#1
How to test if KillTimer has been called?
As the title says.
I can't seem to find anything on MSDN on this subject.
The timers being used aren't HANDLE variables; rather, they are declared like #define IDT_TIMER 100.
Thanks!
-
August 5th, 2009, 04:48 PM
#2
Re: How to test if KillTimer has been called?
What do you mean by "How to test"?
Just set a breakpoint and/or use TRACE and debug!
Victor Nijegorodov
-
August 5th, 2009, 11:25 PM
#3
Re: How to test if KillTimer has been called?
And how IDT_TIMER 100 is used?
-
August 6th, 2009, 01:29 AM
#4
Re: How to test if KillTimer has been called?
You don't need resources to use a timer... you can simply use settimer/killtimer.
-
August 6th, 2009, 11:06 AM
#5
Re: How to test if KillTimer has been called?
Sorry, I guess I should have been more clear!
I want to programmatically, at some point in the code, test if a certain timer has been killed. If so, I want to do nothing. Otherwise, do something.
IDT_TIMER is used like: SetTimer(hWnd, IDT_TIMER);
-
August 6th, 2009, 11:17 AM
#6
Re: How to test if KillTimer has been called?
Originally Posted by jojo080889
IDT_TIMER is used like: SetTimer(hWnd, IDT_TIMER);
1. SetTimer API has for arguments, not two.
2. Why do you need (or think that you need) to "programmatically, at some point in the code, test if a certain timer has been killed"?
Victor Nijegorodov
-
August 6th, 2009, 11:18 AM
#7
Re: How to test if KillTimer has been called?
You could always maintain a flag that you set to true when you start the timer and false when you kill it.
-
August 6th, 2009, 11:40 AM
#8
Re: How to test if KillTimer has been called?
whoops, sorry, I meant to write KillTimer, not SetTimer!
Well, it's kind of complicated to explain why I need to do this, but I'll try my best.
I'm working on code that is basically video calls over IP. When Phone A calls Phone B, Phone A starts a timer for the time they have to wait for a person to answer. Phone B, upon receiving the request, has a timer that starts for the time they have to answer the call before the call will time out.
These timers should be for the same length, but there is a little bit of delay related to the time it takes for one phone to even realize that another phone is calling it.
So, sometimes, Phone B will be able answer even when Phone A's timer has been killed, and weird stuff happens.
Therefore, I want Phone A to be able to test if its timer has been killed before a call starts. If it's been killed, ignore the call. If not, proceed as normal.
If there really is not way to see if a timer has been stopped, I'll probably go with a flag, thanks It's just kind of a pain in the butt with the way the code is set up.
-
August 6th, 2009, 01:26 PM
#9
Re: How to test if KillTimer has been called?
Originally Posted by jojo080889
If there really is not way to see if a timer has been stopped, I'll probably go with a flag, thanks It's just kind of a pain in the butt with the way the code is set up.
There really isn't any Win32 api to do it. I suppose if you know the original SetTimer parameters for the ID that you would like to check, then you could call KillTimer and look for a successful return value. If KillTimer returns a success, then you know the timer was running and you can use the parameters to restart the timer. Of course that would interupt the current timer interval and could be up to a bit more than twice the regular interval.
Tags for this Thread
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
|