public static extern bool GetWindowInfo(IntPtr hwnd, ref WindowInfo info);
public static WindowInfo GetWindowInfo(IntPtr hwnd) { WindowInfo wnfo = new WindowInfo(); wnfo.cbSize = Marshal.SizeOf(wnfo); if (!Api_User32.GetWindowInfo(hwnd, ref wnfo)) throw new Win32Exception(Marshal.GetLastWin32Error(), "Unable to retrieve window information."); return wnfo; }