title: How to get Unicode window title correctly
body: <p>I create Win32 console application that does a simple task: it enumerates captions of all windows. Everything works well except one little point – “non-English” titles are returned as “GDI+ Window”.</p>
  
  <p>I do not know how to retrieve such captions in a right way.</p>
  
  <p>For example, I have window with the caption: Hello Мир. However, GetWindowTextW returns “Hello GDI+ Window”</p>
  
  <p>There is my program code (simplified):</p>
  
  <pre><code>
      BOOL CALLBACK nextWindow ( HWND window, LPARAM param )
      {
          int i = GetWindowTextW ( ... );
          wprintf ( ... );
          return true;
      }
  
      int main ()
      {
          WNDENUMPROC func = &nextWindow;
          LPARAM someValue = 0;
  
          BOOL result = EnumWindows ( func, someValue );
          return 0;
      }
  
  </code></pre>
  
  <p>There is my Project Settings:
  <a href="https://i.stack.imgur.com/yVSHT.png" rel="nofollow noreferrer">Visual Studio Project Settings</a></p>
  
  <p>Thank you!</p>