Jump to content
  • Advertisement
Sign in to follow this  
powerskill

C++ MessageBox Error

This topic is 4162 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!