Example #1
0
        public static Rectangle GetExtendedFrameBounds(IntPtr windowHandle)
        {
            var rect = new WinApi.RECT();

            if (DwmGetWindowAttribute(windowHandle, DWMWA_EXTENDED_FRAME_BOUNDS, ref rect, (UInt32)Marshal.SizeOf(typeof(WinApi.RECT))) != 0)
            {
                // fallback
                WinApi.GetWindowRect(windowHandle, out rect);
            }

            return(new Rectangle(rect.left, rect.top, rect.right - rect.left + 1, rect.bottom - rect.top + 1));
        }
Example #2
0
 private static extern int DwmGetWindowAttribute(IntPtr hwnd, UInt32 dwAttribute, ref WinApi.RECT pvAttribute, UInt32 cbAttribute);