Graphics Programming with DirectX
CreateWindowEx
is a macro, which expands to either CreateWindowExA
or CreateWindowExW
based on whether UNICODE has been defined. Many WinAPI functions work this way: they have a macro which switches between the appropriate functions based on UNICODE, then have the A and W versions.
Now, the difference between the A and W versions is simple.
The A version handles text based on Windows code pages, while the W version handles Unicode text.
If we use A version and set window title, we get freaking Chinese characters in the title area.
But if we switch to the W version, we get a nice result.
CreateWindowExA
accepts LPCSTR
data type as the title, on the other hand, CreateWindowExW
accepts LPCWSTR
as the title. We can simply place an L
in front of the char array/string to convert LPCSTR
to LPCWSTR
.