As with any new development environment, there are some caveats that you should be aware of when mixing managed and unmanaged code. In this part, we examine a few of the most common problems encountered by those new to mixed-mode programming:
Avoiding inadvertent #define side-effects
Allocating reference objects in MFC debug builds
Using string literals and converting strings
One of the first issues you're sure to run into is the problem caused when you attempt to use a function, operator, or type that has been #define'd to a different value than you expect. One example of that is in attempting to use the MessageBox::Show method:
using namespace System; ... // Display a message ...