private static RECT GetClientRectRelativeToWindowRect(IntPtr hwnd) { RECT lpRect1; NativeMethods.GetWindowRect(hwnd, out lpRect1); RECT lpRect2; NativeMethods.GetClientRect(hwnd, out lpRect2); var point = new Core.Platform.Point { X = 0, Y = 0 }; NativeMethods.ClientToScreen(hwnd, ref point); lpRect2.Offset(point.X - lpRect1.Left, point.Y - lpRect1.Top); return(lpRect2); }