private static bool GetExtendedFrameBounds(IntPtr handle, out Rectangle rectangle) { var result = NativeFunctions.DwmGetWindowAttribute(handle, DwmApi.DWMWINDOWATTRIBUTE.DWMWA_EXTENDED_FRAME_BOUNDS, out var rect, Marshal.SizeOf(typeof(RECT))); rectangle = rect.ToRectangle(); return(result == 0); }