API's MessageBox

Source: Internet
Author: User

function function:

The MessageBox function is used to display a modal dialog box that contains a system icon, a set of buttons, and a brief application-specific message, such as status or error information.
The message box returns an integer value that indicates which button the user clicked.


API function Prototypes:

Note: _in_ indicates that the parameter is input, and _opt_ indicates that the parameter is an optional parameter.

1 int WINAPI MessageBox (2  _in_opt_  hwnd hwnd,3  _in_opt_  LPCTSTR Lptext,4  _in_opt_  lpctstr lpcaption,5  _in_      UINT Utype 6 );

Parameter resolution:

Parameters Meaning
HWnd 1. Handle to the parent window of the message box
2. If this parameter is NULL, the message box does not have a parent window
Lptext Contents of the message box
Lpcaption The title of the message box
Utype 1. Specify a set of bit flags that determine the content and behavior of the dialog box
2. This parameter can display the buttons and icons in a message box by specifying a combination of the following flags or flags


Utype parameter definition Resolution:

Button Meaning
Mb_ok Default value, there is a "confirm" button inside
Mb_yesno There are "yes" and "no" two buttons in the inside
Mb_abortretryignore There are "Abort", "Retry" and "Skip" three buttons inside
Mb_yesnocancel There are "yes", "No" and "Cancel" three buttons in the inside
Mb_retrycancel There are "Retry" and "Cancel" two buttons inside
Mb_okcancel There are "OK" and "Cancel" two buttons inside



Icon Meaning
Mb_iconexclamation An exclamation point appears in the message box: <ignore_js_op>
Mb_iconwarning An exclamation point appears in the message box (IBID.)
Mb_iconinformation An icon that consists of a small letter I in a circle appears in the message box: <ignore_js_op>
Mb_iconasterisk An icon with a small letter I in a circle appears in the message box (IBID.)
Mb_iconquestion A problem marker icon appears in the message box: <ignore_js_op>
Mb_iconstop A Stop message icon appears in the message box: <ignore_js_op>
Mb_iconerror A Stop message icon appears in the message box (IBID.)
Mb_iconhand A Stop message icon appears in the message box (IBID.)



Default button Meaning
Mb_defbutton1 Specify the first button as the default button
Mb_defbutton2 Specify a second button as the default button
Mb_defbutton3 Specify a third button as the default button
Mb_defbutton4 Specify a fourth button as the default button



message box morphology Meaning
Mb_applmodal 1. The user must respond to a message box before continuing to work in the window identified by the HWND parameter
2. However, the user can move to another thread's window and work in those windows
3. Depending on the hierarchy of Windows in the application, the user moves to other windows within the thread
4. All child windows of the parent message box are automatically invalidated, but the popup window is not
5. If neither Mb_systemmodal nor Mb_taskmodal is specified, the Mb_applmodal is the default
Mb_systemmodal 1. Except the message box has the Wb_ex_topmost type, otherwise mb_applmodal and Mb_systemmodal
2. Use the System modal message box to change a variety of users, major corruption errors require immediate attention (for example, memory overflow)
3. If the window is not associated with the HWND, this flag has no effect on the user's interaction with the window
Mb_taskmodal 1. If the parameter hWnd is NULL, Mb_taskmodal and Mb_applmodal are the same, except for all windows that belong to the current thread's high level.
2. You can use this flag when the calling application or library does not have a window handle that can be obtained, but you still need to block other windows from being entered into the calling thread, instead of shelving other threads

Other signs Meaning
Mb_default_desktop_only 1. The current desktop receiving input must be a default desktop, otherwise the function call fails
2. The default desktop is a desktop that the user has logged and the application runs on
Mb_help 1. Add a Help button to the message box
2. Select the Help button or press F1 to generate a Help event
Mb_right Text is right-justified
Mb_rtlreading Display messages and uppercase text in right-to-left order in Hebrew and Arabic systems
Mb_setforeground 1. message box becomes foreground window
2. Call the SetForegroundWindow function in the internal system for the message
Mb_topmost The message box is created with the Ws_ex_topmost window type mb_service_notification


return value:

return value Meaning
IDOK The user pressed the "Confirm" button
IDCANCEL The user pressed the Cancel button
Idabort The user pressed the Abort button
Idretry The user pressed the retry button
Idignore The user pressed the Ignore button
Idyes The user pressed the "Yes" button
Idno The user pressed the "no" button



Links: http://bbs.fishc.com/forum.php?mod=viewthread&tid=46730&extra=page%3D1%26filter%3Dtypeid%26typeid% 3d420

API's MessageBox

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.