You forgot to place 'L' before the string literal. Modify as follows:
int nResult=MessageBox(NULL,
L"An example of Cancel,Retry,Continue",
L"Message Box!",
MB_ICONWARNING|MB_ABORTRETRYIGNORE);
In C++ unicode string literals are prefixed with L
. If you don't put the prefix, casting to 'unicode string constant' won't help and causes incorrect interpreting of the memory location.