CWnd::MessageBox

Call this member function to create a message box.

Syntax

int MessageBox ( LPCTSTR lpszText, LPCTSTR lpszCaption = NULL, UINT nType = MB_OK );

At a Glance

Header File Afxwin.h
Platforms
Versions 1.0 and later
Complete documentation Visual C++ documentation

Remarks

Windows CE does not support the MB_SYSTEMMODAL, MB_TASKMODAL, MB_HELP, MB_RIGHT, MB_RTLREADING, MB_DEFAULT_DESKTOP_ONLY, MB_SERVICE_NOTIFICATION, or MB_USERICON styles in the nType parameter.

Tip Sometimes it is necessary for a message box to appear on top of all other windows. In particular, under low memory conditions, the System Out of Memory dialog box will send a WM_CLOSE message to an application. If the application is not in the foreground, any message box it puts up will be hidden behind the current foreground window unless you create the message box with the MB_SETFOREGROUND style. Putting the message box in the foreground will not bring the application's main window forward, so be sure to put any information the user may need, to decide what action to take, in the message box. For more information on the System Out of Memory dialog box, see System Out of Memory Dialog Box.

See Also

CWnd Overview, CWnd Member Functions, Window Class Categories, WM_CLOSE