public static extern bool GetWindowInfo(IntPtr hwnd, ref WINDOWINFO pwi);
public static bool GetBorderSize(IntPtr handle, out Size size) { WINDOWINFO wi = new WINDOWINFO(); bool result = GetWindowInfo(handle, ref wi); if (result) { size = new Size((int)wi.cxWindowBorders, (int)wi.cyWindowBorders); } else { size = Size.Empty; } return result; }