I want a Timer fuction on Non UI thread
-
I have a application in which i need a timer event to fire at some regular interval say 1 to 10 seconds. But durint this interval other Buttons on the Dialogbox are not responing . So i want a method were i can call this timer function by which it runs on non UI thread. any idea thank you
-
I have a application in which i need a timer event to fire at some regular interval say 1 to 10 seconds. But durint this interval other Buttons on the Dialogbox are not responing . So i want a method were i can call this timer function by which it runs on non UI thread. any idea thank you
You can use CreateWaitableTimer. It will create a timer that uses events.
-
I have a application in which i need a timer event to fire at some regular interval say 1 to 10 seconds. But durint this interval other Buttons on the Dialogbox are not responing . So i want a method were i can call this timer function by which it runs on non UI thread. any idea thank you
If you feel teh timer function takes alot of time .then You can do this . Wherever_Timer_creation_required { setTimer(X,Y,MULL) pthread=AfxCreateThread(); } OnTimer() { pthread->PostThreadMessage(Message) } Now you can handle that message in pthread . Cause is my effort; Effect is God's effort
-
You can use CreateWaitableTimer. It will create a timer that uses events.
I Guess using CreateWaitableTimer with SetTimer and WaitForSingleObject may block ur thread ! Cause is my effort; Effect is God's effort
-
I have a application in which i need a timer event to fire at some regular interval say 1 to 10 seconds. But durint this interval other Buttons on the Dialogbox are not responing . So i want a method were i can call this timer function by which it runs on non UI thread. any idea thank you
-
I have a application in which i need a timer event to fire at some regular interval say 1 to 10 seconds. But durint this interval other Buttons on the Dialogbox are not responing . So i want a method were i can call this timer function by which it runs on non UI thread. any idea thank you
SetTimer
will work just fine. PassNULL
as theHWND
and specify a TimerProc callback function.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!
-
SetTimer
will work just fine. PassNULL
as theHWND
and specify a TimerProc callback function.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!
-
Thanks but i have already tried the SetTimer i have only one option that i didnot wanted to opt that is create a thread. :cool:
Ok, I misunderstood your question. I thought you were wondering how to set up a timer in a non-ui thread that did not have a window available to handle the WM_TIMER message. If your timer function is so lengthy that it interferes with the responsiveness of the UI then your only option is to use a seperate thread for it.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!
-
I Guess using CreateWaitableTimer with SetTimer and WaitForSingleObject may block ur thread ! Cause is my effort; Effect is God's effort
You can't use WaitForSingleObject you have to use MsgWaitForMultipleObjects then Dispatch the message to the other controls while you wait on the timer.