From http://leadtheway.iteye.com/blog/825177
Afxmessagebox function prototype
Int afxmessagebox (lpctstr lpsztext, uint ntype = mb_ OK, uint nidhelp = 0 );
Int afxapi afxmessagebox (uint nidprompt, uint ntype = mb_ OK, uint nidhelp = (uint)-1 );
In the first form, lpsztext indicates the text displayed inside the message box. The title of the message box is the executable file name (such as Hello) of the application ). In the second form, nidprompt is the ID of the text string to be displayed in the string table. When the function is called, the string is automatically loaded from the string table and displayed in the message box. Ntype is a combination of the button style and Icon style displayed in the message box. You can use the | (OR) operator to combine various styles.
Button Style
The "Abort", "retry", and "Ignore" buttons are displayed in the mb_abortretryignore message box.
Mb_ OK show OK button
Mb_okcancel: Show OK and cancel buttons
Mb_retrycancel: Display retry and cancel buttons
Mb_yesno: Yes and no buttons are displayed.
The mb_yesnocancel button indicates yes, no, and cancel.
Icon Style
Mb_iconinformation displays an I icon, indicating a prompt
Mb_iconexclamation displays an exclamation point, indicating a warning.
Mb_iconstop: displays the hand icon, indicating a warning or serious error.
Mb_iconquestion: displays the question mark icon, indicating a question
MessageBox, a function similar to afxmessagebox, Is a member function of the cwnd class:
Int MessageBox (maid, maid = NULL, uint ntype = mb_ OK );
The difference between the two functions: afxmessagebox is simpler than MessageBox, because it is a global function, so it does not need a corresponding window class, but cannot control the message box title, it is often used for internal data output or warning during program debugging; MessageBox is more formal, often used in the application version to be submitted, you can control the title content without using an executable file name with unknown meanings as the title.
Example:
Afxmessagebox ("Are you sure ?", Mb_yesno | mb_iconquestion );
Int A = MessageBox (text ("are you sure you want to delete it? "), Text (" Warning !! "), 4 );
If (A = 6)
Afxmessagebox ("yes ");
Else
Afxmessagebox ("no ");
(Where # define idyes 6 # define IDNO 7)