protected override void ProcessRecord() { if (hWnd == IntPtr.Zero) { hWnd = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle; } WindowInformation result = new WindowInformation(); Rectangle rect = GetWindowRectangle(hWnd); result.X = rect.X; result.Y = rect.Y; result.Height = rect.Height; result.Width = rect.Width; if (USER32.IsIconic(hWnd)) { result.State = WindowState.Minimized; } else if (USER32.IsZoomed(hWnd)) { result.State = WindowState.Maximized; } WriteObject(result); }