   MessageBox error SOLVED
  Hi, today I installed Visual C++ 2005 Express Edition on my PC. Some time ago, i learned programming with a friends compiler, and now i just tryed to make my own lil message box programm.int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nShowCmd){MessageBox(NULL, "ASD", "TITLE", MB_OK);return(0);}But when I try to compile this lil programm, my compiler prints out the followig error:f:\projekte\windows2\main.cpp(18) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [4]' to 'LPCWSTR'   Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castDo you know why?[Edited by - m4ster on June 14, 2006 12:52:35 PM]
  Hey, I found the error by myself.My compiler used the MessageBoxW function, not the MessageBoxA...<BG>   ;  the app is using unicode. you can wrap your strings in the text macro.MessageBox(NULL, TEXT("ASD"), TEXT("TITLE"), MB_OK);;  do this:MessageBox(NULL, L"ASD", L"TITLE", MB_OK);Edit: darn, too late!   ;  Or change the project settings to use the multi-byte character set instead of Unicode. I presume you're using VS2005?   ;Quote:Original post by DigiDudedo this:MessageBox(NULL, L"ASD", L"TITLE", MB_OK);Edit: darn, too late!i could be wrong, but i think using the TEXT macro is safer in case you later decide to switch to or from unicode in your app.   ;Quote:Original post by gumpy macdrunkenQuote:Original post by DigiDudedo this:MessageBox(NULL, L"ASD", L"TITLE", MB_OK);Edit: darn, too late!i could be wrong, but i think using the TEXT macro is safer in case you later decide to switch to or from unicode in your app.I looked it up (actually I just looked at intellisense stuff, or at least I think that's what it is) and it said this:#define TEXT(quote) __TEXT(quote)#define __TEXT(quote) LquoteLooks about the same? Well, in light of this new discovery I think I'll keep using L just because it's less to type.[smile];Quote:Original post by DigiDudeLooks about the same? Well, in light of this new discovery I think I'll keep using L just because it's less to type.[smile]And when UNICODE's not defined it should be "... (quote) quote".If you're going to use the 'L' prefix, undefine UNICODE and try to compile...These macros are very useful.   