Sign in to follow this  
frozen_hell1618

help(c++ api)

Recommended Posts

Whenever i try MessageBox(NULL,"CAPTION","NOTE",MB_OK); it hits me with ERROR c2664: cannot convert parameter 2("CAPTION") from 'const char[7]' to 'LPCWSTR' (i am running MSV2005 profesional,and i dont think the header windows changed so much) Why is giving me this ERROR? Thanx for reading this.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
it has to do with unicode, i gues.
changing project properties->configuration properties->general->character set to 'not set' should help.

Share this post


Link to post
Share on other sites
You are building with the Unicode Win32 API.

Either turn it off:
Project Properties -> Config Props -> General -> Character Set = 'Not Set'

Or use Unicode strings.
MessageBox(NULL, L"CAPTION", L"NOTE", MB_OK);

Share this post


Link to post
Share on other sites
Quote:
Original post by frozen_hell1618
real thanx mean,real thanx now why did it gave that error,i know unicode is a 64 buffer?


I dont know what you're talking about with the 64 buffer, but C++ has two types used to represent characters (can also be used for numbers) char and wchar_t, on most current platforms char is used to represent an ASCII character and wchar_t is used to represent an Unicode character. When you have your character set, set to Unicode the Win32 function will accept strings like this:
LPCWSTR, which is a typedef for const wchar_t*
If you have your character set, set to multi-byte it will accept a string like this:
LPCSTR, which is a typedef for const char*
You passed a const char* (well actually const char[]) to a function expecting a const wchar_t* and it couldn't convert it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this