2.1.27.20 MessageBox
Description
Open a Windows message box.
Syntax
int MessageBox( HWND hWnd, LPCSTR lpText, LPCSTR lpCaption = NULL, UINT uType = MB_OK )
Parameters
- hWnd
- [input]Handle of parent window
- lpText
- [input] Text of the message to be displayed
- lpCaption
- [input]Title of the message box, default is NULL
- uType
- [input]Constants describing the characteristics of the message box. One constant from each group below
- can be combined using the bitwise OR operator "|", default is MB_OK
- Buttons on message box: MB_OK, MB_OKCANCEL, MB_ABORTRETRYIGNORE, MB_YESNOCANCEL, MB_YESNO,
- MB_RETRYCANCEL
- Icon on message box: MB_ICONHAND, MB_ICONQUESTION, MB_ICONEXCLAMATION, MB_ICONASTERISK,
- MB_ICONINFORMATION, MB_ICONSTOP
- Default button of message box: MB_DEFBUTTON1, MB_DEFBUTTON2, MB_DEFBUTTON3
- Modality of message box: MB_APPLMODAL, MB_SYSTEMMODAL, MB_TASKMODAL
- Mask of message box: MB_TYPEMASK, MB_ICONMASK, MB_DEFMASK, MB_MODEMASK, MB_MISCMASK
Return
Returns one of the following integer constants depending on which button is clicked: IDOK=1,
IDCANCEL=2, IDABORT=3, IDRETRY=4, IDIGNORE=5, IDYES=6, IDNO=7, IDCLOSE=8, IDHELP=9
Examples
EX1
int MessageBox_ex1()
{
if( MessageBox( GetWindow(), "Undo not available. Do you want to continue?", "Warning!" , MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2 ) == IDNO )
{
out_str("\"No\" was clicked.");
return 0;
}
out_str("\"Yes\" was clicked.");
return 1;
}
Remark
Open a Window's message box.
See Also
MessageBeep
Header to Include
origin.h
Reference
|