public static RECT GetWindowRect(IntPtr hwnd) { RECT result; if (!NativeMethods._GetWindowRect(hwnd, out result)) { HRESULT.ThrowLastError(); } return(result); }