|
-
June 7th, 1999, 09:21 AM
#1
Changing SetTimer interval
Hi,
I'm using SetTimer in my Dialog based program. One of the options I need to have is to change the timer interval. I wrote the code for changing the number, but how do I reset the SetTimer to use the new interval, if it is running continuously in the background??
If you have any ideas please let me know.
Thanks, Ron.
-
June 7th, 1999, 09:58 AM
#2
Re: Changing SetTimer interval
Set a flag that it needs to be changed and in the next Timer event and call SetTimer again with the new time.
HTH,
Chris
-
June 7th, 1999, 10:37 AM
#3
Re: Changing SetTimer interval
How?
I have my SetTimer in OnInitDialog. Once the 'user' pushes a button to change the interval, a new dialog is opened to input the new interval. After IDOK, the interval variable (A global) value is changed to the new one. Is my SetTimer in the wrong place? if not, How do I set a flag for it to modify the interval?
-
June 7th, 1999, 11:29 AM
#4
Re: Changing SetTimer interval
You only have to kill the old timer and create a new one with the new time interval. When your dialog receives the OnTimer() message, you are given the ID of the timer. If you only have 1 timer in your app, there is no need to change your code, but if you have more then 1 you will have to create the new timer with the same ID number as the one you killed.
Just after getting the new value you could do the following code :
KillTimer(m_TimerID) ; // from when you used SetTimer in OnInitDialog()
m_TimerID = SetTimer(1, NewTime, NULL) ; // to use the new time value
HTH
Roger Allen
Please use meaningful question titles - "Help me" does not let me know whether I can help with your question, and I am unlikely to bother reading it.
Please remember to rate useful answers. It lets us know when a question has been answered.
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
|