I'm fairly new at this but I have run into a problem with MessageBox(). When I try to use a MessageBox in my program instead of popping up on the client area of the main window it hides behind the entire window. How do I make the MessageBox appear where it is supposed to. What am I doing wrong.
is the first field of your messagebox set to the HWND of your window?
I can't tell for sure unless I see some code. Post some code of what your trying to do and I might be able to help. You might have to make sure that you use the appropriate Handle (hwnd) and not NULL which defaults to the desktop.
I often use 0 as the first argument of the MessageBox function when debugging if I just want a response at a particular time and can't be bothered to find the handle to an appropriate window. I haven't ever come across this sort of problem. As sean said, we need more info (i.e. your code ;) )
Thanks for the advice. This program is fairly large with many functions. While I was developing the program I often used MessageBox for debugging purposes. I never had any trouble at all.
Now I have encountered this problem. It doesn't matter where I put the MessageBox or what function I place it in. It doesn't matter whether I use the hwnd or NULL. I have never had this problem before and I can't figure it out. There is no use furnishing code for the problem might be anywhere. I wouldn't know what code to furnish. This is very strange.
Thanks again. :confused:
Try furnishing it all, or at least the parts that are most likely to be relevant.
edit: if it's really big, use an attachment, not code tags
Look for any SetWindowPos() with HWND_TOPMOST flags. This may pu you window at the very top of the screen.
Try specifying the MB_SETFOREGROUND or MB_TOPMOST flags.