public static void GetWindowSize(IntPtr hwnd, out int width, out int height) { User.Struct.WINDOWINFO wi = Windows.GetWindowInfoStruct(hwnd); width = wi.rcWindow.Right - wi.rcWindow.Left; height = wi.rcWindow.Bottom - wi.rcWindow.Top; }