help(c++ api)
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.
it has to do with unicode, i gues.
changing project properties->configuration properties->general->character set to 'not set' should help.
changing project properties->configuration properties->general->character set to 'not set' should help.
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.
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);
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement