Use L"text"
to create your strings. This way you're creating a wide string which most-likely are expected from the WinAPI.
#include <Windows.h>
#include <string>
using namespace std;
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
PSTR cmdLine,
int showCmd)
{
MessageBox(0, L"First Win32 Program.", L"My App", MB_OK);
}
The problem is you're injecting a narrow string by using a C-style cast to LPCWSTR
. So two of your narrow chars (8 bit each) will end mixed-up in one UNICODE char (16 bit each).