title: Chinese characters in Title bar
body: <p>I am creating a Win32 application, ASCII only. However, when I create the window, the title bar shows chinese characters, instead of the intended text:</p>
  
  <pre><code>//registering the window class:
  WNDCLASSEXA wc = { };
  
  wc.hInstance = hThisInstance;
  wc.lpszClassName = g_classname;
  wc.lpfnWndProc = WndPrc;
  wc.style = 0;
  wc.cbSize = sizeof (WNDCLASSEXA);
  wc.hIcon = (HICON) LoadImage(GetModuleHandle(NULL),
                               MAKEINTRESOURCE(IDI_APPICO), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
  wc.hIconSm = (HICON) LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_APPICO),
                              IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
  wc.hCursor = LoadCursor(NULL, IDC_ARROW);
  wc.lpszMenuName = MAKEINTRESOURCE(IDR_MENU);
  wc.cbClsExtra = 0;              /* no extra bytes after the window class */
  wc.cbWndExtra = 0;                   /* structure or the window instance */
  wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE); /*(HBRUSH) GetStockObject(WHITE_PEN);*/
  
  if (!RegisterClassEx(&amp;wc))
      return FAIL;
  return OK;
  
      g_hwndMain = CreateWindow(g_classname, "Hello World", WS_OVERLAPPEDWINDOW,
                                g_progsettings.winX, 
                                g_progsettings.winY,
                                g_progsettings.winWidth,
                                g_progsettings.winHeight, 
                                0, 0, NULL, 0);
  
      if (!g_hwndMain) {
          MessageBox(NULL, "Couldn't make window", "CreateWindowEx", 
                            MB_OK | MB_ICONERROR);
          exit(EXIT_FAILURE);
      }
  
      if (g_progsettings.winX == -1 &amp;&amp; g_progsettings.winY == -1)
          centerwin(g_hwndMain);
  
      /* Make the window visible on the screen */
  
      ShowWindow(g_hwndMain, nCmdShow);
      UpdateWindow(g_hwndMain);
  </code></pre>
  
  <p>Here is the titlebar:</p>
  
  <p><a href="https://i.stack.imgur.com/9mz80.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9mz80.png" alt="enter image description here"></a></p>
  
  <p>When I run the program repeatedly, I still get the same titlebar. <code>UNICODE</code> is not <code>#define</code>d.</p>
  
  <p>Unlike other similar questions, I am not casting a <code>const char *</code> into a <code>LPCWSTR</code> or vice versa, so that shouldn't be the cause of the problem.</p>
  
  <p>Here is my <code>WinMain</code> (a lot of irrelevant details)</p>
  
  <pre><code>INT WINAPI WinMain(HINSTANCE hInst,HINSTANCE hPrevInstance,LPSTR lpszArgument, int nCmdShow)
  {
      MSG msg;
      HACCEL hAccel;
      BOOL msgRet;
      INITCOMMONCONTROLSEX icex;
  
      if (signal(SIGSEGV, onSegfault) == SIG_ERR) {
          errmsg("Failed to register handler for SIGSEGV", "");
          return EXIT_FAILURE;
      }
  
      icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
      icex.dwICC = ICC_STANDARD_CLASSES;
      if (InitCommonControlsEx(&amp;icex) == FALSE) {
          fmtmsgbox(MB_ICONERROR, "extended common controls err: %s", fmtmsg());
          return EXIT_FAILURE;
      }
  
      if (winregister(hInst) == FAIL)
          errmsg("window class error", "window class");
  
  
      memset(&amp;g_progsettings, 0, sizeof (settings));
      if (g_progsettings.readSettings() == FAIL)
          g_progsettings.setDefaults();
  
      mainwindow(hInst, nCmdShow);
      hAccel = LoadAccelerators(hInst, MAKEINTRESOURCEA(IDR_ACCEL));
  
  
      onCreat();
  
      while ((msgRet = GetMessageW(&amp;msg, NULL, 0, 0)) != 0) {
          if (msgRet == -1) {
              errmsg("GetMessage -1", fmtmsg());
              exit(EXIT_FAILURE);
          }
          if (!g_fd.isdlgmsg(&amp;msg)) {
              if (!TranslateAcceleratorW(g_hwndMain, hAccel, &amp;msg)) {
                  TranslateMessage(&amp;msg);
                  DispatchMessage(&amp;msg);
              }
          }
      }
      return 0;
  }
  </code></pre>