I am getting this error message - a value of type "const char *" cannot be assigned to an entity of type"LPCWSTR"

222 Views Asked by At

These are the lines of code that are causing the error:

    WndClass.lpszClassName = "WinProg";

and

hWindow = CreateWindow("WinProg", "Window", WS_OVERLAPPEDWINDOW, 0, 0, 400, 400, NULL, NULL, hInstance, NULL);

I don't know how to "fix" this error.

1

There are 1 best solutions below

1
Dino On

When building for UNICODE, prefix string literals like this:

L"wide string literal"

and they will be wchar_t, not char.

In your case, it should be:

WndClass.lpszClassName = L"WinProg"