public static Rect GetWindowRect(IntPtr hwnd) { RECT rect = new RECT(); GetWindowRect(hwnd, out rect); return new Rect(rect.Left, rect.Top, rect.Right - rect.Left, rect.Bottom - rect.Top); }
static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);