internal static Rect GetWindowDims(IntPtr hndl) { Rect returnRect = new Rect(); WIN_RECT winLoc = new WIN_RECT(); WIN_RECT winDim = new WIN_RECT(); User32.GetWindowRect(hndl, ref winLoc); User32.GetClientRect(hndl, ref winDim); returnRect.X = winLoc.left; returnRect.Y = winLoc.top; returnRect.Width = winLoc.right - winLoc.left; returnRect.Height = winLoc.bottom - winLoc.top; return returnRect; }
public static extern IntPtr GetWindowRect(IntPtr hWnd, ref WIN_RECT rect);
public static extern IntPtr GetClientRect(IntPtr hWnd, ref WIN_RECT rect);