title: Windows title bar icon
body: <p>I have a problem with setting the titlebar icon for my application.</p>
  
  <p>I have been trying to figure this out, Googling what is wrong, for 2 days already, without any success.</p>
  
  <p>MainWindow.cpp:</p>
  
  <pre><code>#include "../../res/Icons.h"
  
  void MainWindow::Create(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
  {
      const wchar_t CLASS_NAME[]  = L"MainWindow";
      WNDCLASSEX wc = {};
      wc.cbSize = sizeof(wc);
      wc.lpfnWndProc = WindowProc;
      wc.hInstance = hInstance;
      wc.lpszClassName = CLASS_NAME;
      wc.hIcon = LoadIcon(NULL,IDI_MYICON);
      wc.hIconSm = LoadIcon(NULL,IDI_MYICON);
      wc.hCursor = LoadCursor(NULL, IDC_ARROW);
      wc.hbrBackground = CreateSolidBrush(RGB(255,255,255));
      RegisterClassEx(&amp;wc);
  
      HWND hwnd = CreateWindowEx(0, CLASS_NAME, wstring(Language::wText[1].begin(),Language::wText[1].end()).c_str(), WS_SYSMENU | WS_CAPTION | WS_MINIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, NULL, NULL, hInstance, NULL);
      ShowWindow(hwnd, nCmdShow);
  
      MSG msg = {};
      while (GetMessage(&amp;msg, NULL, 0, 0))
      {
          TranslateMessage(&amp;msg);
          DispatchMessage(&amp;msg);
      }
  }
  </code></pre>
  
  <p>Icons.h</p>
  
  <pre><code>#define IDI_MYICON 1000
  </code></pre>
  
  <p>Icons.rc</p>
  
  <pre><code>IDI_MYICON ICON "App.ico"
  </code></pre>
  
  <p>It compiles fine, and the icon is shown in the Taskbar, as well as in the executable file, but not in the titlebar.  The icon is a standard ico with dimensions of 32x32.  I have even tried using <code>LoadImage()</code>, but same result. </p>
  
  <p><a href="https://i.stack.imgur.com/laGE7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/laGE7.png" alt="image"></a></p>