Detailed usage of messagebox () in c ++

Source: Internet
Author: User

1. MessageBox ("this is the simplest message box! "); 2. MessageBox (" this is a message box with a title! "," Title "); 3. MessageBox (" this is a message box to confirm cancellation! "," Title ", MB_OKCANCEL); 4. MessageBox (" this is a warning message box! "," Title ", MB_ICONEXCLAMATION); 5. MessageBox (" this is a message box with two attributes! "," Title ", MB_ICONEXCLAMATION | MB_OKCANCEL); 6.if( MessageBox (" a common application "," title ", MB_ICONEXCLAMATION | MB_OKCANCEL) = IDCANCEL) return; the default icons of other common attributes are attached. The message box displays the X errors MB_ICONHAND, MB_ICONSTOP, and MB_ICONERROR? Ask MB_ICONQUESTION! Warning MB_ICONEXCLAMATION and merge information in the form of the merge and MB_ICONINFORMATION buttons MB_ OK default MB_OKCANCEL determine whether to cancel MB_YESNO MB_YESNOCANCEL whether to cancel return value IDCANCEL unselect IDNO no selected IDOK confirm selected IDYES is selected supplement: the message box is used in the subclass of CWnd. If not, MessageBox (NULL, "ddd", "ddd", MB_ OK); or MessageBox (hWnd, "ddd", "ddd", MB_ OK); hWnd is the handle of a window, or AfxMessageBox is directly used. The attributes listed here are only some common attributes. In MSDN, there are more attributes: Visual C ++ 2005 compatibility error C2664: "CWnd: MessageBoxW ": parameter 1 cannot be converted from "const char [3]" to "LPCTSTR" error 2 error C2664: "inet_addr ": parameter 1 cannot be converted from "_ TCHAR *" to "const char *" d: \ vc program \ clienttcp. cpp 29 cause: 2005 the default "use Unicode Character Set" solves: in the properties of the project file of the solution you created, select "use multi-Byte Character Set" for "Character Set Configuration property. 2005 this error does not occur when you open a 6.0 file because the compiling environment is converted during the conversion process.

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.