2 Replies - 7245 Views - Last Post: 10 March 2009 - 07:43 PM Rate Topic: -----

#1 likesoursugar  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 10-March 09

'MessageBoxW' : 'const char [29]' to 'LPCWSTR'

Posted 10 March 2009 - 03:29 PM

Hi. I've done some opengl tutorials and I got the sorucecode and a visual c++ project in a zip file. The program compiled and was able tu run when I loaded the projectfile in vc++ but when I made my own prokect and copied the code and pasted it I got this error why?

1 Error 87 error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [29]' to 'LPCWSTR' f:\programming\opengl\2\nehe5\nehe5\main.cpp

Is This A Good Question/Topic? 0
  • +

Replies To: 'MessageBoxW' : 'const char [29]' to 'LPCWSTR'

#2 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3093
  • View blog
  • Posts: 19,139
  • Joined: 14-September 07

Re: 'MessageBoxW' : 'const char [29]' to 'LPCWSTR'

Posted 10 March 2009 - 04:06 PM

This has to do with various Unicode settings. The easiest/quickest fix would be to "cast" it:

MessageBox(stuff, L"Whatever Text You Have Here", ...);



The L converts it to a LPCWSTR. Hope that helps.
Was This Post Helpful? 1

#3 no2pencil  Icon User is online

  • Toubabo Koomi
  • member icon

Reputation: 5189
  • View blog
  • Posts: 26,896
  • Joined: 10-May 07

Re: 'MessageBoxW' : 'const char [29]' to 'LPCWSTR'

Posted 10 March 2009 - 07:43 PM

** Renamed title to be more descriptive of question **
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1