1. MessageBox ("this is the simplest message box! ");
2. MessageBox ("this is a message box with a title! "," Title ");
3. MessageBox ("this is a confirmation message box! "," 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;
Additional common attributes
Default System icon, which can be displayed in 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
Button format
Mb_ OK default
Mb_okcancel confirm cancel
Mb_yesno?
Whether mb_yesnocancel is canceled
Return Value
Idcancel unselect
IDNO no selected
Idok determines to be 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 common attributes, and more attributes are available in msdn.
Error c2664: "cwnd: messageboxw" for compatibility with Visual C ++ 2005: parameter 1 cannot be converted from "const char [3]" to "lpctstr" Error 2 error c2664: "inet_addr": you cannot convert parameter 1 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.