WinMessageBox

From EDM2
Jump to: navigation, search

WinMessageBox generates a dialog sub-window for user's intervention or acknowledgement.

Syntax

WinMessageBox(dsktpHndlPrnt, dsktpHndlOwnr, message, title, windowId, windowStyle)

Parameters

dsktpHndlPrnt - HWND - input 
The desktop handle.
dsktpHndlOwnr - HWND - input 
The window owner handle.
message - PSZ - input 
The message to display in the dialog.
title - PSZ - input 
The string to display in the dialog's window bar. NULL - The title of Error is displayed.
windowId - ULONG - input 
Message box window identity. windowId is passed to the HK_HELP hook if the WM_HELP message is received by the message-box window. This value must be greater or equal to 0 and less or equal to 0xffff.
windowStyle - ULONG - input 
Dictates the button, icon, and modal groups to apply to this dialog.

Constants

Button or Button Group

MB_OK
Displays an OK push button.
MB_OKCANCEL
Displays both OK and CANCEL push buttons.
MB_CANCEL
Displays a CANCEL push button.
MB_ENTER
Displays an ENTER push button.
MB_ENTERCANCEL
Displays both ENTER and CANCEL push buttons.
MB_RETRYCANCEL
Displays both RETRY and CANCEL push buttons.
MB_ABORTRETRYIGNORE
Displays ABORT, RETRY, and IGNORE push buttons.
MB_YESNO
Displays both YES and NO push buttons.
MB_YESNOCANCEL
Displays YES, NO, and CANCEL push buttons.

Help button

MB_HELP
Displays a HELP push button. When this is selected a WM_HELP message is sent to the window procedure of the message box.

Color or Icon

MB_ERROR
Displays a small red circle with a red line across it.
MB_ICONASTERISK
Displays an information (i) icon.
MB_ICONEXCLAMATION
Displays an exclamation point (!) icon.
MB_ICONHAND
Displays a small red circle with a red line across it.
MB_ICONQUESTION
Displays a question mark (?) icon.
MB_INFORMATION
Displays an information (i) icon.
MB_NOICON
Displays no icon.
MB_QUERY
Displays a question mark (?) icon.
MB_WARNING
Displays an exclamation point (!) icon.

Default action

MB_DEFBUTTON1
The first button is the default selection. This is the default case, if none of MB_DEFBUTTON1, MB_DEFBUTTON2, and MB_DEFBUTTON3 is specified.
MB_DEFBUTTON2
The second button is the default selection.
MB_DEFBUTTON3
The third button is the default selection.

Modality indicator

MB_APPLMODAL
Dialog is application modal. This is the default case. Its owner is disabled; therefore, do not specify the owner as the parent if this option is used.
MB_SYSTEMMODAL
Dialog is system modal.

Mobility indicator

MB_MOVEABLE
Dialog is moveable.

The message box is displayed with a title bar and a system menu, which shows only the Move, Close, and Task Manager choices, which can be selected either by use of the pointing device or by accelerator keys.

If the user selects Close, the message box is removed and the usResponse is set to MBID_CANCEL, whether or not a cancel button existed within the message box.

Returns

MBID_ENTER
ENTER was selected
MBID_OK
OK was selected
MBID_CANCEL
CANCEL was selected
MBID_ABORT
ABORT was selected
MBID_RETRY
RETRY was selected
MBID_IGNORE
IGNORE was selected
MBID_YES
YES was selected
MBID_NO
NO was selected
MBID_ERROR
Function had an error

Module

PMMERGE

Define (C/C++)

INCL_WINDIALOGS

Calling Convention

Cdecl32

Example Code

...
APIRET rc;
rc = WinMessageBox (HWND_DESKTOP, thisWndwHndl, "Yes to proceed, No to exit", "Error", 
                    0L, MB_YESNO | MB_WARNING | MB_SYSTEMMODAL);

Related Functions

  • WinAlarm
  • WinFlashWindow
  • WinMessageBox2