title: Why does GetSystemMetrics() return these values?
body: <p>I am having some issues creating a client area of a set size. AdjustWindowRect() won't work properly so I decided to try manually calculating the width and height of the window.</p>
  
  <p>That didn't work either and I wondered why so I checked up the values I used to take in account the borders etc.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;Windows.h&gt;
  
  int main(void)
  {
      std::cout &lt;&lt; "GetSystemMetrics(SM_CYEDGE) = " &lt;&lt; GetSystemMetrics(SM_CYEDGE) &lt;&lt; std::endl;
      std::cout &lt;&lt; "GetSystemMetrics(SM_CXEDGE) = " &lt;&lt; GetSystemMetrics(SM_CXEDGE) &lt;&lt; std::endl;
      std::cout &lt;&lt; "GetSystemMetrics(SM_CYBORDER) = " &lt;&lt; GetSystemMetrics(SM_CYBORDER) &lt;&lt; std::endl;
      std::cout &lt;&lt; "GetSystemMetrics(SM_CXBORDER) = " &lt;&lt; GetSystemMetrics(SM_CXBORDER) &lt;&lt; std::endl;
      std::cout &lt;&lt; "GetSystemMetrics(SM_CYCAPTION) = " &lt;&lt; GetSystemMetrics(SM_CYCAPTION);
  
      std::cin.get();
  }
  </code></pre>
  
  <p>This gives me:</p>
  
  <pre><code>GetSystemMetrics(SM_CYEDGE) = 2
  GetSystemMetrics(SM_CXEDGE) = 2
  GetSystemMetrics(SM_CYBORDER) = 1
  GetSystemMetrics(SM_CXBORDER) = 1
  GetSystemMetrics(SM_CYCAPTION) = 22
  </code></pre>
  
  <p>I am PRETTY sure that the borders of my window aren't that thin. What am I doing wrong?</p>
  
  <p><strong>EDIT 1:</strong> </p>
  
  <p>Initially my window used the WS_OVERLAPPED style. Since the AdjustWindowRect does not allow that style to be used alongside it I constructed the same type of window I wanted with: (WS_BORDER | WS_CAPTION | WS_SYSMENU). This is the same style I use during the call to AdjustWindowRect and AdjustWindowRectEx(this one with NULL as extended style since I do not use any). This gives me the correct width but the height is missing a few pixels.</p>
  
  <pre><code>RECT rect = { 0, 0, 800, 600};
  
  AdjustWindowRectEx( &amp;rect, (WS_BORDER | WS_CAPTION | WS_SYSMENU), FALSE, NULL);
  
  CreateWindowEx( ..., rect.right - rect.left, rect.bottom - rect.top, ...);
  </code></pre>
  
  <p>This gives me 800 pixels wide client-area but only 582 pixels in height.</p>
  
  <p><strong>EDIT 2:</strong></p>
  
  <p>CURIOUS, I used GetClientRect(); and it gave me that the width is 800 and the height IS 600. How come it doesn't display properly?</p>
  
  <hr>
  
  <p>It seems that when I painted the whole window it all measured up. The reason? I don't know.</p>
  
  <p>Maybe someone else can shed some light over this.</p>