What is the diference in this commands?
AfxMessageBox("Test"); -----and
MessageBox("Test");
Printable View
What is the diference in this commands?
AfxMessageBox("Test"); -----and
MessageBox("Test");
The afx call is meant for use under MFC. It supports a help context as well.
MessageBox will work for platform SDK development, as well as MFC. No help context.
AfxMessageBox does a few things for you.
First it selects a title for the message box (the application name or if that doesn't exist the exe file name). Then it chooses a default icon based on the buttons you specify if you haven't selected an icon.
Then AfxMessageBox does the setup for the context help. It uses an MFC-internal mechanism for that.
Finally AfxMessageBox calls the WinAPI MessageBox.
Actually most of this is done by CWinApp::DoMessageBox, but this is hidden from the user.
AfxMessageBox has an overload which takes an UINT instead of a string. This overload loads the string resource identified by the UINT parameter and then calls the string version passing the newly loaded string. Very useful for localization.
MessageBox is a plain windows API function, included in user32.dll. You would use it in standard Win32 projects that do not require MFC.
AfxMessageBox comes with MFC. I think by using it you add an extra "layer" of processing to your program.
hope that helps :)