const char* and LPCWSTR conversion

Hi everyone,

I was messing around with a Win32 API tutorial today and I came across multiple errors when using MessageBox's - errors from the compiler regarding const char* and LPCWSTR conversion.

When doing research into the problem, I found that the solution was to change my project settings to use 'Multi-Byte Character Set.'

I have implemented this change and all is good, I just wanted to know why this is a solution, what has been changed?

Cheers,

Lonely Sandwich
I'm not quite sure what you are asking.

The wide character version is for unicode strings, the other for ASCII strings. Wide character strings should be default. If you want to type a unicode string literal in your program, consider this:
1
2
"Hello World!" // ASCII string literal
L"Hello World!" // unicode string literal 


Regards
-Xander314
Last edited on
If you are using chars instead of TCHARs or wchar_t's, then use the 'A' version of WinAPI functions (don't call MessageBox, call MessageBoxA)

char = MessageBoxA
wchar_t = MessageBoxW
TCHAR = MessageBox

See this:

http://www.cplusplus.com/forum/articles/16820/
Topic archived. No new replies allowed.