CWnd::MessageBox

This method creates a message box.

At a Glance

Header file: Afxwin.h
Platforms: H/PC 2.0, Palm-size PC, H/PC Pro
Windows CE versions: 1.0 and later
Complete documentation: Visual C++ documentation

Syntax

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

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.

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.

See Also

WM_CLOSE