Jump to content
  • Advertisement

Archived

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

Prozak

Window Message Handling

This topic is 5474 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Its n00b question time (I should know this btw, shame on me): Ok, I create 5 windows. How do I create the following loop to handle all their messages?
/**///->[-Message Loop-]	

while(WndNotClosed)
{
   WaitMessage();
   GetMessage(msg, NULL,0,0);
   TranslateMessage(msg);
   DispatchMessage(msg);	
};	
Do I have to look into "msg.hwnd", and that gives me a pointer to one of my 5 windows? (im betting that is the answer) Thanx,

[Hugo Ferreira][Positronic Dreams]
All your code are belong to us!

Share this post


Link to post
Share on other sites
Advertisement
The second parameter to GetMessage (you supplied NULL) takes the handle of the windows whose messages you want to get.

Supplying NULL will get the message of any window in your thread. Thus the loop you showed us will already handle their messages.

BTW, you don''t need to have WaitMessage in front of GetMessage, since GetMessage will also suspend the current thread if no messages in the queue.

Share this post


Link to post
Share on other sites
Please read the winprog.org tutorials if you''re not 100% certain how to set up your message loop. Getting it wrong leads to REALLY REALLY HARD to track down errors.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!