Seems simple but can't find the solution.
I want something like this
catch (Exception^ ex) { MessageBoxA(NULL, ex->ToString(), "", MB_OK); }
But it says Plattform::string ^ is incompatible with LPCSTR.
Platform::String is .NET class, which is of course is not compatible with good old char*.
char*
To fix this you need to do 2 things.
First, convert Platform::String to wchar_t*, since it's unicode string. Use method Data()
Platform::String
wchar_t*
Data()
Second, use MessageBoxW, since we are working with unicode, not ANSI.
Resulting code should look like this:
MessageBoxW(NULL, ex->ToString()->Data(), "", MB_OK);
Platform::String is .NET class, which is of course is not compatible with good old
char*
.To fix this you need to do 2 things.
First, convert
Platform::String
towchar_t*
, since it's unicode string. Use methodData()
Second, use MessageBoxW, since we are working with unicode, not ANSI.
Resulting code should look like this: