title: Why does GetWindowLong have ANSI and Unicode variants?
body: <p>I found out today that <code>GetWindowLong</code> (and <code>GetWindowLongPtr</code>) has 'ANSI' (A) and 'Unicode' (W) flavours, even though they don't have <code>TSTR</code> arguments. The <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms633584%28v=vs.85%29.aspx" rel="nofollow">MSDN page on <code>GetWindowLong</code></a> only indicates that these variants exist, but doesn't mention why.</p>
  
  <p>I can imagine that it must match the encoding of <code>CreateWindowEx</code> (which also has A/W flavours) or <code>RegisterClass</code>, but for many reasons, I don't think this makes sense. Apparently, it matters, because <a href="http://www.realsoftware.com/listarchives/realbasic-nug/2003-12/msg01663.html" rel="nofollow">someone reported that the Unicode version may fail on XP</a> (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 <code>USER32.DLL</code> (which contains both flavours of <code>GetWindowLong</code>), and there is extra work done based on some apparent encoding difference*.</p>
  
  <p>Which function am I supposed to choose?</p>
  
  <hr>
  
  <p>*The flavours of <code>GetWindowLong</code> 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.</p>