public static Rectangle GetClientRect(IntPtr hWnd) { RECT bnds = new RECT(); if (Api_User32.GetClientRect(hWnd, ref bnds)) { return(new Rectangle(bnds.left, bnds.top, bnds.Width, bnds.Height)); } else { return(Rectangle.Empty); } }