//save the current size of the active window public void saveActiveWindowSize() { activeRestore = new WINDOWPLACEMENT(); activeRestore.length = Marshal.SizeOf(activeRestore); if (!GetWindowPlacement(activeHandle, ref activeRestore)) { throw new Exception("GetWindowPlacement failed to get active window restore information"); } }
static extern bool GetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl);