Jump to content

Message box problem


Recommended Posts

This is a weird problem I've had come up in a number of different apps I've developed. It always just seems to appear randomly (particularly when I use up a lot of GDI resources) and pretty much never goes away, even after I reboot. The problem is message boxes (from MessageBox()) don't show up. They make a sound, the main window loses focus, a program I have which sits things on top of the active window will jump to where the box should appear, and I can activate the buttons with Y, N, Escape, Space, etc but the box doesn't actually show up on the screen. It won't let me click the box's parent window, as expected, but I can click other children. Switching to another app makes it impossible to get the box back into focus and so I have to kill the process. The same happens if I don't specify a parent window. It's not appearing under the window, either. I've never seen any other app do this, but it happens to pretty much all of mine and I can't tell why.

And this place needs a frowning post icon that isn't mad. <_<

Link to comment
Share on other sites


I think I sometimes have the same thing. When I use standard GDI and create ownerless MessageBox'es they are not visible. But I remember that you can press the Alt key and for whatever reason they appear then…

I can't give a real solution for that, but I think this problem doesn't occour when you specify an owner window in the MessageBox() call.

Link to comment
Share on other sites

Blah, more problems popping up. My combo boxes don't have scrollbars even with the WS_VSCROLL style, and I can type in them. The style I'm using is CBS_HASSTRINGS | CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_VSCROLL.

Yay, 100 posts.

Edited by HyperHacker
Link to comment
Share on other sites

  • 1 year later...

I am surprized no one put an answer to this problem. The reason there is a problem with MessageBox has nothing really to do with MessageBox but with WM_PAINT. If you remove WM_PAINT completely from your WndProc function, then the system handles the creation of the window which in turn makes the Message Box appear immediatly without needing to press ALT to view it. The reason ALT allows you to view it is because WM_PAINT for the MessageBox itself is not in your program but in the system, and the window has to redraw for the popup window you create for the Move and Close fuctions that Alt unlocks. Also you will notice if you pressed ALT and the MessageBox extends past your parent window, the MessageBox will be cut off, but it won't be if you didn't have WM_PAINT declared as one of your switch cases for WinProc. Hopefully that pointed you in the right directon to fix your problem.

Will

PS - A simple solution to get you by might be to put the WM_PAINT as the second to last declarion with default being the last declaration. Then remove or comment out break; so that after WM_PAINT is called, your painting functions first and then WM_PAINT will be passed through the system next.

Edited by WilliamW1979
Link to comment
Share on other sites

I am surprized no one put an answer to this problem. The reason there is a problem with MessageBox has nothing really to do with MessageBox but with WM_PAINT. If you remove WM_PAINT completely from your WndProc function, then the system handles the creation of the window which in turn makes the Message Box appear immediatly without needing to press ALT to view it. The reason ALT allows you to view it is because WM_PAINT for the MessageBox itself is not in your program but in the system, and the window has to redraw for the popup window you create for the Move and Close fuctions that Alt unlocks. Also you will notice if you pressed ALT and the MessageBox extends past your parent window, the MessageBox will be cut off, but it won't be if you didn't have WM_PAINT declared as one of your switch cases for WinProc. Hopefully that pointed you in the right directon to fix your problem.

Will

PS - A simple solution to get you by might be to put the WM_PAINT as the second to last declarion with default being the last declaration. Then remove or comment out break; so that after WM_PAINT is called, your painting functions first and then WM_PAINT will be passed through the system next.

DefWindowProc(). Use it.

Regarding the comboboxes... have you made them too short? They need to be taller than the actual text area itself...

Edited by LLXX
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...