Most Windows functions that handle strings come in two versions, an ANSI version with an A
suffix and a Unicode version with a W
suffix.
For example, GetWindowText
is actually exported as two functions, GetWindowTextA
and GetWindowTextW
. These names appear near the bottom of the documentation.
An LPTSTR
parameter is interpreted as LPSTR
for the A
version and LPWSTR
for the W
version. You can use either function, but clearly you have to use the appropriate string type to go with it.
The C version works because GetWindowText
is actually a C macro that expands to either GetWindowTextA
or GetWindowTextW
depending on whether you have the UNICODE
macro defined.