Re: messabebox(...) v afxmessanebox
"Roger Rabbit" <roger@rabbit.com> ha scritto nel messaggio
news:4D883F27-FC5A-4BF1-90F7-81F79474C6BA@microsoft.com...
any material difference between messagebox and afxmessagebox to display a
message for development testing?
I think that AfxMessageBox is the MFC version of ::MessageBox, which is pure
Win32 API.
AfxMessageBox is better integrated in MFC framework, and you should use
AfxMessageBox in MFC development.
AfxMessageBox offers also some new feature with respect to ::MessageBox,
e.g. with AfxMessageBox you can specify a string resource numeric ID (so the
message string is loaded from the string table, and not embedded as string
literal in source code). This is good for internationalization.
If you want only to show the messages in some type of builds, you can use
preprocessor macros, like this:
#ifdef TESTING_BUILD
#define TEST_MSG( msg ) AfxMessageBox( msg );
#else
#define TEST_MSG( msg ) ; /* nothing */
#endif // TESTING_BUILD
So, in your code you can use
...
TEST_MSG( _T("Something happens here..." )
...
and the message will be shown only if you have #defined the TESTING_BUILD
preprocessor label.
Giovanni