title: GetWindowRect returns a size including "invisible" borders
body: <p>I'm working on an app that positions windows on the screen in a grid style. When Running this on Windows 10, there is a huge gap between the windows. Further investigation shows that <code>GetWindowRect</code> is returning unexpected values, including an invisible border, but I can't get it to return the real values with the visible border.</p>
  
  <p>1) <a href="https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/6c1c67a9-5548-4e9b-989f-c7dbac0b1375/getwindowrect-on-nonresizable-windows-under-aero-glass?forum=windowsuidevelopment" rel="noreferrer">This thread</a> suggests this is by design and you can "fix" it by linking with winver=6. My environment does not allow this but I've tried changing the PE <code>MajorOperatingSystemVersion</code> and <code>MajorSubsystemVersion</code> to 6 with no affect</p>
  
  <p>2) That same thread also suggests using <code>DwmGetWindowAttribute</code> with <code>DWMWA_EXTENDED_FRAME_BOUNDS</code> to get the real coordinates from DWM, which works, but means changing everywhere that gets the window coordinates. It also doesn't allow the value to be set, leaving us to reverse the process to be able to set the window size.</p>
  
  <p>3) <a href="https://stackoverflow.com/a/30330342/588306">This question</a> suggests it's lack of the DPI awareness in the process. Neither setting the DPI awareness flag in the manifest, or calling <code>SetProcessDpiAwareness</code> had any result.</p>
  
  <p>4) On a whim, I've also tried adding the Windows Vista, 7, 8, 8.1 and 10 compatibility flags, and the Windows themes manifest with no change.</p>
  
  <p><a href="https://i.stack.imgur.com/bI9ad.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bI9ad.png" alt="Screenshot of a &quot;fullscreen&quot; window with gaps all round"></a>
  This window is moved to 0x0, 1280x1024, supposedly to fill the entire screen, and when querying the coordinates back, we get the same values.
  The window however is actually 14 pixels narrower, to take into account the border on older versions of Windows.</p>
  
  <p>How can I convince Windows to let me work with the real window coordinates?</p>