C++ MessageBox Error

Started by
2 comments, last by CrazyCdn 16 years, 9 months ago
I used to be able to fix this error but for some reason I forgot how. Anyone know?

MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
// Compiler Error 1>.\main.cpp(36) : error C2664: 'MessageBox' : cannot convert parameter 2 from 'const char *' to 'LPCTSTR' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast Thanks
Advertisement
It looks like your program is being compiled in Unicode mode. Either switch to using wide character strings or change your project to be compiled in MBCS mode. For MSVC it's under project properties/general/character set.
thanks :-)
On a side now, MessageBox has nothing what-so-ever to do with C++ ;-) It's part of the Windows Win32 API which is all C.

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety." --Benjamin Franklin

This topic is closed to new replies.

Advertisement