public bool Equals(WindowRect rectangle) { return rectangle.Left == _Left && rectangle.Top == _Top && rectangle.Right == _Right && rectangle.Bottom == _Bottom; }
internal static extern bool GetWindowRect(IntPtr hWnd, ref WindowRect rect);
public static Window FromHandle(IntPtr hwnd) { WindowRect rect = new WindowRect(); if(hwnd == IntPtr.Zero || !WinApi.GetWindowRect(hwnd, ref rect)) { return null; } Window window = new Window { Handle = new WindowHandle() {Handle = hwnd}, X = rect.X, Y = rect.Y, Width = rect.Width, Height = rect.Height, Title = GetTitle(hwnd) }; return window; }