public windowRect(IntPtr hWnd) { NativeMethods.GetWindowRect(hWnd, out this); windowRect delta = new windowRect(); NativeMethods.AdjustWindowRectEx(ref delta, NativeMethods.GetWindowLong(hWnd, GWL_STYLE), false, NativeMethods.GetWindowLong(hWnd, GWL_EXSTYLE)); left -= delta.left; right -= delta.right + 1; top -= delta.top; bottom -= delta.bottom + 1; }
internal static extern bool AdjustWindowRectEx(ref windowRect rect, int dwStyle, [MarshalAs(UnmanagedType.Bool)] bool bMenu, int dwExStyle);
internal static extern bool GetWindowRect(IntPtr hWnd, out windowRect rect);