MessageBox () function

Source: Internet
Author: User
MessageBox () is a commonly used Win32 API. A window is displayed on the screen, asking questions and waiting for user input. The prototype is int MessageBox (hwnd, lpctstr lptext, lpctstr lpcation, uint utype)
Hwnd is the parent window handle. If it is set to null, Windows desktop is used as the parent window.
Lptext is a null string that contains text.
The title of the message box is a string ending with null.

Utype this parameter specifies the type of message boxes to display. There are many types of this parameter, So I directly paste it from the Encyclopedia:

Button:

Mb_ OK
Default value. There is a confirmation button in it.
Mb_yesno
Yes and no.
Mb_abortretryignore
There are abort (discard), retry (retry) and ignore (skip)
Mb_yesnocancel
The message box contains three buttons: yes, no, and cancel.
Mb_retrycancel
Retry and cancel are available)
Mb_okcancel
The message box contains two buttons: OK and cancel.

Icon:

Mb_iconexclamation
An exclamation point appears in the message box
Mb_iconwarning
An exclamation point appears in the message box
Mb_iconinformation
The icon consisting of letters I in a circle appears in the message box.
Mb_iconasterisk
The icon consisting of letters I in a circle appears in the message box.
Mb_iconquestion
A question mark icon appears in the message box
Mb_iconstop
A stop message icon appears in the message box.
Mb_iconerror
A stop message icon appears in the message box.
Mb_iconhand
A stop message icon appears in the message box.

Form:

Mb_applmodal
Before continuing to work in the window marked by the hwnd parameter, the user must respond to the message box. However, you can move to windows of other threads and work in these windows. Based on the window hierarchy in the application, the user moves to another window in the thread. The subwindows of all parent message boxes automatically expire, but the pop-up window does not. If neither mb_systemmodal nor mb_taskmooal is specified, mb_applmodal is the default value.
Mb_systemmodal
Besides the wb_ex_topmost type in the message box, the mb_applmodal and mb_systemmodal types are the same. Use the system modal message box to change various users. Pay attention to major damage errors (for example, memory overflow ). If it is not for Windows that are connected with hwnd, this flag does not affect the user's interaction with windows.
Mb_taskmodal
If the hwnd parameter is null, The mb_taskmodall and mb_applmodal parameters are the same except for all window failures at the high level of the current thread. This flag is used when no window handle is available for calling an application or library. However, you still need to block the input to other windows of the calling thread, rather than shelving other threads.

Others:
Mb_default_shorttop_only
The current desktop that receives input must be a default desktop. Otherwise, the function call fails. The default desktop is a desktop on which applications run after the user logs.
Mb_help
Add a Help button to the message box. Select the Help button or Press F1 to generate a help event.
Mb_right
Adjust text to the right
Mb_rtlreading
In the Hebrew and Arabic systems, messages and uppercase text are displayed sequentially from right to left.
Mb_setforeground
The message box is changed to the foreground window. In the internal system, call the setforegroundwindow function for messages.
Mb_topmost
The message box uses the ws_ex_topmost window type to create mb_service_notification.


MessageBox functions return values:

Idok (1) OK
Idcancel (2) Cancel
Idabort (3) Abort
Idretry (4) retry
Idignore (5) Ignore
Idyes (6) Yes
IDNO (7) No


MessageBox () function

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.