Archived

This topic is now archived and is closed to further replies.

hellfire

I need help with the window messeges

Recommended Posts

I have this very instanive loop that I run in my app. While its running I have a dialog window pop up with a progress bar to show how much longer it has to go befor the loop is finished. What I would like to know how to is this, when ever the user generates a window messege I would like the loop process to stop, have the messege handled and than go back to the loop. Does anyone know how to do this? [edited by - hellfire on July 18, 2002 11:18:37 AM]

Share this post


Link to post
Share on other sites
If im understanding you correctly you should be able to use PeekMessage() in your loop to see if there is a message waiting to be processed and if so process it, if not continue with your loop.

I cant remember the actual implementation off the top of my head but if you still need help when I get home ill post again.

Share this post


Link to post
Share on other sites
I''m not 100% sure what you''re trying to do, but here''s my 2 cents:

every time a message is sent and you capture it, you do not return before you''ve handled it (if your intention is to handle it at all). Basically - that means that if you were to handle all of the messages your app is sent, you should be in total control of the speed at which stuff is executed.

Crispy

Share this post


Link to post
Share on other sites
Basically what I need to happen is that whenever a windows messege is created by the user, I need all other processes to stop and the messege to be handled. Than all the processes to stop. The problem with Peekmessege function is that I have to call it within the loop, so the messeges have to wait until that function is called before they can be handled.

Share this post


Link to post
Share on other sites
quote:
Original post by hellfire
The problem with Peekmessege function is that I have to call it within the loop, so the messeges have to wait until that function is called before they can be handled.

If you need true concurrency, use multithreading. Make a worker thread and run your calculation loop there, continually processing messages by your main thread. If you want to stick to one thread, there inevitably will be a delay before a message is processed, because Windows doesn''t interrupt a thread to handle messages, you are asking Windows if any messages are available. Calling PeekMessage from your calculation loop is the best you can do.

---
Come to #directxdev IRC channel on AfterNET

Share this post


Link to post
Share on other sites