title: Setting client area size (after creation)?
body: <p>I want to adjust the height of the client area <em>after</em> creation of the main window. I use <code>CW_USEDEFAULT</code> when creating it and I simply want to resize that to the nearest height which is divisible by a fixed number. I've tried processing <code>WM_SIZE</code>, but it doesn't seem to work like I want it to, and I'm not really sure <code>SetWindowPos</code> is the appropriate way to resize the <em>client</em> area.. ?</p>
  
  <pre><code>LRESULT CALLBACK mainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  {
      switch (message) {
        case WM_SIZE:
          if (HIWORD(lParam) % 15) {
            SetWindowPos(hWnd, NULL, 0, 0, LOWORD(lParam), HIWORD(lParam) / 15 * 15, SWP_NOMOVE);
          }
          return DefWindowProc(hWnd, message, wParam, lParam);
          break;
  
        case WM_DESTROY:
          PostQuitMessage(0);
          break;
  
        default:
          return DefWindowProc(hWnd, message, wParam, lParam);
          break;
      }
  
      return 0;
  }
  </code></pre>
  
  <p>The result is a zero-height client area for some reason:</p>
  
  <p><a href="https://i.stack.imgur.com/oeOol.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oeOol.png" alt="Test"></a></p>
  
  <p>Another couple of approaches I've tried:</p>
  
  <ul>
  <li>Updating the <code>RECT</code> <em>top</em> / <em>bottom</em> members when
  <code>WM_NCCALCSIZE</code> is sent.</li>
  <li>Changing the <code>cy</code> member of the <code>CREATESTRUCT</code> when the <code>WM_CREATE</code>
  message is sent.</li>
  </ul>
  
  <p>Any ideas?</p>