internal static extern bool GetWindowPlacement(IntPtr hWnd, out WINDOWPLACEMENT lpwndpl);
internal static extern bool GetWindowPlacement(IntPtr hWnd, out WINDOWPLACEMENT lpwndpl);
protected virtual void SaveWindowState() { if (_settings == null) { return; } var hwnd = new WindowInteropHelper(_window).Handle; var wp = new WINDOWPLACEMENT(); wp.length = Marshal.SizeOf(wp); UnsafeNativeMethods.GetWindowPlacement(hwnd, ref wp); // check for saveable values if (wp.showCmd != (int)Constants.ShowWindowCommands.SW_HIDE && wp.length > 0) { if (wp.showCmd == (int)Constants.ShowWindowCommands.SW_NORMAL) { RECT rect; if (UnsafeNativeMethods.GetWindowRect(hwnd, out rect)) { wp.normalPosition = rect; } } if (!wp.normalPosition.IsEmpty) { _settings.Placement = wp; } } _settings.Save(); }
internal static extern bool SetWindowPlacement(IntPtr hWnd, [In] ref WINDOWPLACEMENT lpwndpl);