Sure, if you're using MFC.
But you can't have any blocking calls within OnIdle. And OnIdle is only called when the application's message queue is empty.
function looping in windows
K, well I guess I'm gonna be forced to use threads, I've never used them before though so I have another question that I don't see answered on msdn. how do you check to see if a thread is running?
EDIT:nevermind, I was gonna use the loop previously mentioned and create a new thread, check to see if it was running and if not destroy it every iteration but now I'm just creating a thread at initialisation that runs a constantly looped function. I just hope I can get away with running unsychronized threads.
[Edited by - etsuja on May 22, 2006 11:23:05 PM]
EDIT:nevermind, I was gonna use the loop previously mentioned and create a new thread, check to see if it was running and if not destroy it every iteration but now I'm just creating a thread at initialisation that runs a constantly looped function. I just hope I can get away with running unsychronized threads.
[Edited by - etsuja on May 22, 2006 11:23:05 PM]
You can test if a thread is still running or not with WaitForSingleObject. Pass it the handle of the thread and a timeout of zero. If the thread is still running it returns WAIT_OBJECT_0, I believe.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement