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.
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*
.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: