Jump to content
  • Advertisement

Archived

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

Gf11speed

MessageBox() and DirectDraw

This topic is 6485 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

I noticed that when I called the MessageBox() function, that my program pauses until control is returned to the program. How could I get that messagebox or any other type of dialog box, to not pause the program, but instead allow the program to continue while the messagebox or dialog box is being displayed? Help is appciated. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
It can''t be done with a MessageBox, it can be done with a DialogBox, but it''s a bit complicated to explain here. DialogBox''s need their own callback function to process messages.

There''s easier ways to display info to the screen, like TextOut(). What are you trying to achieve?

Share this post


Link to post
Share on other sites
I may be wrong, but would setting the window handle to the desktop (or other window) instead of the current app window, achieve this?

or maybe u could trick it by sending a message (for example IDYES | IDNO for a Yes No messagebox) telling the main loop that the yes/no has been pressed, when it actually hasn''t?

correct me if/why im wrong

******************************
Peasant:>"Help Help Im being repressed!"

King Arthur:>"Bloody Peasant!"

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by sutek

I may be wrong, but would setting the window handle to the desktop (or other window) instead of the current app window, achieve this?

or maybe u could trick it by sending a message (for example IDYES | IDNO for a Yes No messagebox) telling the main loop that the yes/no has been pressed, when it actually hasn''t?

correct me if/why im wrong

******************************
Peasant:>"Help Help Im being repressed!"

King Arthur:>"Bloody Peasant!"


The call to MessageBox does not return until the message box is closed, regardless of the hWnd you passed in. You could set hWnd to anything you like, but the thread that calls MessageBox will wait until the message box is closed before continuing.
In a single-threaded application you could create a non-modal dialog box, like simon_brown75 suggests, using CreateDialog, but you would need to create the dialog resource and dialog proc first.
In a multi-threaded application you could call MessageBox from a thread that you don''t mind if it pauses while the message box is being displayed.
Or how ''bout this. Create a new thread that just calls MessageBox. I''m not sure that creating a new thread just to display a message box is the best thing in the world.
Depending on what you are trying to do, I like simon_brown75''s other suggestion. Use TextOut() to write to the screen.
Anyway, I hope I didn''t ramble too much.

Share this post


Link to post
Share on other sites
Well, I am not just trying to write on the screen. I am trying to get input from the user as well... as with dialog boxes that will allow the program to acquire text from the user. But while doing this, I don''t want to have the program paused during this time. Also, what is a thread?????

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!