MessageBox ,z-order

netcrazy used Ask the Experts™
In my program i pop up a message box at some point. If there are other windows open, then the message box  goes into the background. I wanted to bring the messagebox into foreground. I tried using MB_TOPMOST|MB_SETFOREGROUND flag in the message box function, but did not get the expected result.

Please let me know the solution for this prob, I have a vc++ prg and am using MFC
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Did you properly set the parent window (hWnd Parameter)?

int MessageBox( HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType);

Is your application in foreground when the message box pop-up? If no, you can use MB_SYSTEMMODAL.


Thank You,
  Adding MB_SYSTEMMODAL. gave me the required soln.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial