I found out today that GetWindowLong
(and GetWindowLongPtr
) has 'ANSI' (A) and 'Unicode' (W) flavours, even though they don't have TSTR
arguments. The MSDN page on GetWindowLong
only indicates that these variants exist, but doesn't mention why.
I can imagine that it must match the encoding of CreateWindowEx
(which also has A/W flavours) or RegisterClass
, but for many reasons, I don't think this makes sense. Apparently, it matters, because someone reported that the Unicode version may fail on XP (even though XP is NT and, as I understand it, all Unicode under the hood). I have also tried to disassemble the 32-bit version of USER32.DLL
(which contains both flavours of GetWindowLong
), and there is extra work done based on some apparent encoding difference*.
Which function am I supposed to choose?
*The flavours of GetWindowLong
are identical, except for a boolean they pass around to other functions. This boolean is compared to a flag bit in a memory structure I can't be bothered to track down using static code analysis.