CWnd::MessageBox
int MessageBox( LPCTSTR lpszText, LPCTSTR lpszCaption = NULL, UINT nType = MB_OK );
Return Value
Type: int
If a message box has a Cancel button, the function returns the IDCANCEL value if either the ESC key is pressed or the Cancel button is selected. If the message box has no Cancel button, pressing ESC has no effect.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If the function succeeds, the return value is one of the following menu-item values.
Return code/value | Description |
---|---|
|
The Abort button was selected.
|
|
The Cancel button was selected.
|
|
The Continue button was selected.
|
|
The Ignore button was selected.
|
|
The No button was selected.
|
|
The OK button was selected.
|
|
The Retry button was selected.
|
|
The Try Again button was selected.
|
|
The Yes button was selected.
|
Parameters
nType
The following message-box styles are available.
- MB_ABORTRETRYIGNORE The message box contains three pushbuttons: Abort, Retry, and Ignore.
- MB_OK The message box contains one pushbutton: OK.
- MB_OKCANCEL The message box contains two pushbuttons: OK and Cancel.
- MB_RETRYCANCEL The message box contains two pushbuttons: Retry and Cancel.
- MB_YESNO The message box contains two pushbuttons: Yes and No.
- MB_YESNOCANCEL The message box contains three pushbuttons: Yes, No, and Cancel.
- MB_APPLMODAL The user must respond to the message box before continuing work in the current window. However, the user can move to the windows of other applications and work in those windows. The default is MB_APPLMODAL if neither MB_SYSTEMMODAL nor MB_TASKMODAL is specified.
- MB_SYSTEMMODAL All applications are suspended until the user responds to the message box. System-modal message boxes are used to notify the user of serious, potentially damaging errors that require immediate attention and should be used sparingly.
- MB_TASKMODAL Similar to MB_APPLMODAL, but not useful within a Microsoft Foundation class application. This flag is reserved for a calling application or library that does not have a window handle available.
沒有留言:
張貼留言