Note that there are some explanatory texts on larger screens.

plurals
  1. POForm tells wrong size on Windows 8 — how to get real size?
    primarykey
    data
    text
    <p>Having a WinForms form with form border style set to <code>Sizable</code> on Windows 8, the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.form.desktopbounds.aspx" rel="nofollow noreferrer"><code>DesktopBounds</code> property</a> tells the correct values:</p> <p><img src="https://i.stack.imgur.com/mQYgy.png" alt="enter image description here"></p> <p>In contrast, when having a form border style of <code>FixedDialog</code>, the values are wrong:</p> <p><img src="https://i.stack.imgur.com/FTQKm.png" alt="enter image description here"></p> <p>On Windows XP, the values are always correct:</p> <p><img src="https://i.stack.imgur.com/peX0B.png" alt="enter image description here"></p> <p><img src="https://i.stack.imgur.com/A6ymH.png" alt="enter image description here"></p> <p><strong>My question is:</strong></p> <p>How to get the real size of a Window including the complete non-client area?</p> <p><strong>Update 1:</strong></p> <p>Seems that it is related to <a href="https://stackoverflow.com/questions/3192232/getwindowrect-too-small-on-windows-7">this SO question</a>. I'll try and see whether this would solve my issue here, too.</p> <p><strong>Update 2:</strong></p> <p>Just for completeness, here are the results from a VMware Windows 7:</p> <p><img src="https://i.stack.imgur.com/IyXaE.png" alt="enter image description here"></p> <p><img src="https://i.stack.imgur.com/6qTxT.png" alt="enter image description here"></p> <p><strong>Update 3:</strong></p> <p>Finally found a solution which involves using the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa969515%28v=vs.85%29.aspx" rel="nofollow noreferrer"><code>DwmGetWindowAttribute</code> function</a> together with the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa969530%28v=vs.85%29.aspx" rel="nofollow noreferrer"><code>DWMWA_EXTENDED_FRAME_BOUNDS</code> value</a>. I'll post an answer below.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload