There are several things you should know about the Win32 API:
1) It is designed to work with both wide character (multibyte) strings as well as narrow character (single byte) strings. It does this by having two of most functions: an 'A' variant and a 'W' variant. For example, there are two message box functions, namely, MessageBoxA() which works with narrow character strings and MessageBoxW() which works with wide character strings.
2) To control which type of string is used the Win32 API provides the symbol UNICODE. When UNICODE is defined the functions like MessageBox() are #defined as MessageBoxW(). When UNICODE is not defined functions like MessageBox() are #defined as MessageBoxA().
3) Starting with MSVC++ 2005 UNICODE is defined by default.
4) This complicates life when working with string literals and pointers to strings so the Win32 API also defines several string datatypes
CHAR: a narrow character
PSTR, PCSTR, LPSTR, LPCSTR: A pointer to an array of narrow characters
WCHAR: a wide character
PWSTR, PCWSTR, LPWSTR, LPCWSTR: A pointer to an array of wide characters
TCHAR: CHAR when UNICODE is not defined, WCHAR when UNICODE is defined
PTSTR, PCTSTR, LPTSTR, LPCTSTR: Analogous to the above
Prefer to use TCHAR in your dealings with Win32. If you're going to use std::string I would use something like this
typedef basic_string<TCHAR> tstring;
and then use tstring rather than string.
5) When working with string literals, wrap them in the TEXT macro. TEXT will make the string literal a wide string when UNICODE is defined and a narrow string when UNICODE is not defined.
This is what can solve your problem. Rewrite your code to be
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance ,LPSTR lpCmdLine ,int nCmdShow){ MessageBox( NULL , TEXT("Hi!"), TEXT("Win32 - Creating a Message Box") , MB_OK ); return 0;}