0

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.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
KenReid
  • 1
  • 1
  • 2
    Does this answer your question? [cannot convert 'const char\*' to 'LPCWSTR {aka const wchar\_t\*}'](https://stackoverflow.com/questions/40641572/cannot-convert-const-char-to-lpcwstr-aka-const-wchar-t) – General Grievance Jan 26 '22 at 16:57

1 Answers1

2

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"
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Dino
  • 21
  • 3
  • 2
    *Technically*, it *should* be using the `TEXT()` macro instead, eg: `WndClass.lpszClassName = TEXT("WinProg");` (same with the string parameters of `CreateWindow()`) since he is calling the `TCHAR`-based `RegisterClass()`+`CreateWindow()` macros, instead of directly calling the Unicode `RegisterClassW()`+`CreateWindowW()` functions. – Remy Lebeau Aug 09 '22 at 19:57