LPCWSTR
is a pointer to a "wide" character string (the W in the name), which is a 16 bit per character string to encode unicode characters (utf 16 encoding).
Take a look at the remark at the end of this page https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-wndclassexa.
To make it simple there are "two version" of parts the win32 API, one that uses ANSI (~ASCII) and one that uses UNICODE. Depending on the definition of the UNICODE
preprocessor constant, some function and struct will be defined to a version or the other.
For example the WNDCLASSEX
struct is a macro that is equivalent to WNDCLASSEXA
in ANSI and WNDCLASSEXW
in unicode. In a similar way RegisterClassEx
can be RegisterClassExA
or RegisterClassExW
.
Casey will talk about that at some point in the series (near the beginning).
In your case to suppress the warning, you can use
WindowClass.lpszClassName = L"handmadeHeroWindowClass";
// or
WindowClass.lpszClassName = TEXT("handmadeHeroWindowClass");
// Seed https://learn.microsoft.com/en-us/windows/win32/api/winnt/nf-winnt-text
A side note, is that LPCWSTR stands for
- LP long pointer (not sure about the long part, but it's a pointer);
- C for constant;
- W for wide;
- STR for string.
In full: long pointer to a constant wide string.