   C++ newbie question
  Hello all!I am reading Windows Game Programming for Dummies.When I try to build the first Hello World windows program I run into trouble with my Visual C++ 2008 Express.The code:#define WIN32_LEAN_AND_MEAN#include <windows.h>#include <stdafx.h>// main for win progsint WINAPI WinMain(HINSTANCE hinstance,   HINSTANCE hprevinstance,   LPSTR lpcmdline,   int ncmdshow){// call message box APIMessageBox(NULL,"What's up, world!","Hello y'all!",MB_OK);// exit progreturn(0);} // end WinMainI already changed <windodsx.h> to <stdafx.h> based on a first error mesage.I get this error message now: "error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [18]' to 'LPCWSTR'".Is there a compatibility problem or can I set soemthing general to make the code in that book just work as is?Sorry if this looks like a silly question but I never made Windows programs before.signed: Ariella's husband   
  Your project is in UNICODE mode, the example was probably written in ASCII (multibyte).Try this#define WIN32_LEAN_AND_MEAN#include <windows.h>#include <stdafx.h>// main for win progsint WINAPI WinMain(HINSTANCE hinstance,HINSTANCE hprevinstance,LPSTR lpcmdline,int ncmdshow){// call message box APIMessageBox(NULL,TEXT("What's up, world!"),TEXT("Hello y'all!"),MB_OK);// exit progreturn(0);} // end WinMainThe TEXT() macro will convert your strings at compile time to the appropriate format as per the project settings.   ;  Thanks a lot!Your answer made a bell ring.  I looked at Project>Properties and then under Configuration Properties>General I found the Character Set under Project Defaults.  I have set that to Multi-Byte and the program code works now!!!So this is probably my overall solution for using the code in the book.   ;  The safest way to handle these kinds of things without messing with the project settings is to use the "neutral" character type.Windows provides the TCHAR type, which will map to the appropriate character type depending on the projects settings.  So instead of using CHAR or WCHAR in your code, replace them with TCHAR.  Then any of the literals, just wrap in the TEXT macro.  This will make your code automatically adapt to the appropriate settings.Unless you hit a major roadblock (and there are a few of them out there), I'd probably leave your project set to UNICODE, as this is basically native for most of the modern Windows OS's.   ;  I tried the 3rd option for that project setting : "Not Set".  Is that what you mean by neutral?The original code (without TEXT(...) ) works in the "Not Set" mode.And a new question popped up: does the Charater Set have influence on performance?Thanks again for answers that are faster than lightning!!!   ;  Sorry for the misunderstanding.  My example was on making the code neutral, so your code doesn't really care which version is set (UNICODE is probably optimal, since this is basically the native codeset now.  Note that it does require more memory to represent characters).TCHAR String = TEXT("Hi");When Unicode is enabled:TCHAR translates to WCHARTEXT("Hi") translates to L"Hi"soWCHAR String = L"Hi";When Multibyte is enabledTCHAR translates to CHARTEXT("Hi") translates to "Hi"soCHAR String = "Hi";You'll find this also applies to many of the Microsoft functions (MessageBox for example).  MessageBox is actual a macro that maps to different functions depending on the project settingsUnicode: MessageBoxW (this is how I knew what was wrong in your example)Multibyte: MessageBoxA[edit]You can also call the ...A and ...W version directly, but usually the reasons to do this require very specific circumstances to want to.   