public static string SaveWindowPlacementToSettings(this Window window) { WindowPlacement wp = new WindowPlacement(); IntPtr hwnd = new WindowInteropHelper(window).Handle; NativeMethods.GetWindowPlacement(hwnd, out wp); return wp.ToString(); }
public static extern bool GetWindowPlacement(IntPtr hWnd, out WindowPlacement lpwndpl);
public static extern bool SetWindowPlacement(IntPtr hWnd, [In] ref WindowPlacement lpwndpl);