   Strange Message Box Text Display Bug
  There's some kind of bug in this code:void Character::ShowStats(){std::string playerStats = "Level: "+ GetLevel();::MessageBox(0,(LPCWSTR)playerStats.c_str(),L"Player Statistics",MB_OK);}Because instead of showing Level: 1, it shows all set of squares...Link to pictureAnybody know where bug may be?   
Read this;  You can't cast a narrow string to a wide string like that, you have to convert it. There are Win32 functions to do this for you or alternative you could represent the text as a std::wstring which returns a wide string pointer from c_str().   ;  Here is a simple way how to convert std::strings into std::wstrings:std::string foo="foo";std::wstring bar( foo.begin(), foo.end() );Kimmi   ;  I corrected to :void Character::ShowStats(){std::string playerStats = "Level: "+ GetLevel();std::wstring stats(playerStats.begin(),playerStats.end());::MessageBox(0,(LPCWSTR)stats.c_str(),L"Player Statistics",MB_OK);}but now it displays just evel:   ;Quote:Original post by KimmiHere is a simple way how to convert std::strings into std::wstrings:This is not really the safe way to do this.  While regular ASCII characters map pretty much 1:1 with their UTF-16 counterparts, this isn't always true.  If you can't have your strings already in wide format, your going to be better off using one of the Win32 conversion functions like MultiByteToWideChar.   ;  Ok, I haven't known this. Maybe I should correct my internal convertion-method, too. Thanks for that info!Kimmi   ;  I used MultiByteToWideChar() but now I got 2 type cast errors in its argument list :(void Character::ShowStats(){std::string playerStats = "Level: "+ GetLevel();std::wstring stats;MultiByteToWideChar(CP_UTF8,MB_ERR_INVALID_CHARS,(LPCSTR)playerStats,20,(LPWSTR)stats,0);::MessageBox(0,(LPCWSTR)stats.c_str(),L"Player Statistics",MB_OK);};  it's probably because the first cast tries to cast an object into a pointer to a string and the second cast tries achieve the same thing. For the first one you have to use c_str(std::string) in order to return a char* (LPSTR). For LPCSTR, which is what you want, it's basically const char * so I think you can handle yourself >.> As for the wide string, I don't know what to use for that, I'm not familiar with wide strings.   ;  You are probably going to need to make a WCHAR array, instead of trying to use the wstring when using MultiByteToWideChar.   