message box in C + + messagebox () detailed introduction and usage _c language

Source: Internet
Author: User
1.MessageBox ("This is one of the simplest message boxes!") ");
2.MessageBox ("This is a header message box!") "," title ");
3.MessageBox ("This is a confirmation message box for cancellation!") "," title ", Mb_okcancel);
4.MessageBox ("This is a warning message box!") "," title ", Mb_iconexclamation);
5.MessageBox ("This is a message box with two properties!") "," title ", mb_iconexclamation| Mb_okcancel);
6.if (MessageBox ("A Common Application", "title", mb_iconexclamation| Mb_okcancel) ==idcancel)
Return

attached to other common properties

system default icon, which can be displayed on the message box
X Error Mb_iconhand, Mb_iconstop, and Mb_iconerror
? Ask Mb_iconquestion
! Warning Mb_iconexclamation and mb_iconwarning
I information Mb_iconasterisk and mb_iconinformation

the form of a button

MB_OK Default
Mb_okcancel OK cancel
Mb_yesno whether
Mb_yesnocancel is canceled

return value

IDCANCEL canceled to be selected
Idno was chosen
Idok determined to be selected
Idyes was chosen.

Supplements
The use of the above message box is in the CWnd subclass of the application, if not, then MessageBox (NULL, "ddd", "ddd", MB_OK); Or MessageBox (HWnd, "ddd", "ddd", MB_OK); The HWND is a handle to a window, or it is directly afxmessagebox.
The properties listed here are just some of the common properties, and there are more properties in MSDN

Visual c++2005 compatibility issue error C2664: "Cwnd::messageboxw": Cannot convert parameter 1 from "const char [3]" to "LPCTSTR" Error 2 Error C2664: "inet_addr": Cannot convert parameter 1 from "_tchar *" to "const char *" D:\VC program\clienttcp\clienttcp\clienttcp.cpp 29 Reason: 2005 default "Use Unicode Character Set" To resolve: when you build The properties of the project file for the proposed solution see Select "Use multibyte Character set" on the Choose "Character set" of "Configuration Properties". 2005 Open 6.0 of the file does not appear when the error, because the compilation environment in the conversion process is converted

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.