public static Rectangle GetExtendedFrameBounds(IntPtr window) { WinApi.RECT output = new WinApi.RECT(); if (WinApi.DwmGetWindowAttribute(window, WinApi.DWMWINDOWATTRIBUTE.ExtendedFrameBounds, out output, Marshal.SizeOf(output)) == 0) { return(output); } return(GetWindowBounds(window)); }
public static Rectangle GetWindowBounds(IntPtr window) { WinApi.RECT output = new WinApi.RECT(); if (WinApi.GetWindowRect(window, out output)) { return(output); } throw new Exception(string.Format("Couldn't get bounds of window {0}", window)); }