coding style: consolidate command arg of ShowWindow()

This commit is contained in:
Kang Yu 2023-07-08 16:48:49 -07:00
parent 4f36016c60
commit d8a6f54756
2 changed files with 2 additions and 9 deletions

View file

@ -3062,7 +3062,7 @@ namespace PersistentWindows.Common
{
// first try to minimize
if (!IsMinimized(hWnd))
User32.ShowWindow(hWnd, User32.SW_SHOWMINNOACTIVE);
User32.ShowWindow(hWnd, (int)ShowWindowCommands.ShowMinNoActive);
// second try
if (!IsMinimized(hWnd))
@ -3099,7 +3099,7 @@ namespace PersistentWindows.Common
Log.Error("restore minimized window to full screen {0}", GetWindowTitle(hWnd));
need_move_window = false;
restore_fullscreen = true;
User32.ShowWindow(hWnd, User32.SW_NORMAL);
User32.ShowWindow(hWnd, (int)ShowWindowCommands.Normal);
IsWindowMoved(displayKey, hWnd, 0, lastCaptureTime, out curDisplayMetrics, out prevDisplayMetrics);
rect = prevDisplayMetrics.ScreenPosition;
windowPlacement = prevDisplayMetrics.WindowPlacement;

View file

@ -377,13 +377,6 @@ namespace PersistentWindows.Common.WinApiBridge
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool ShowWindowAsync(IntPtr hWnd, int cmd);
public const int SW_NORMAL = 1;
public const int SW_MAXIMIZE = 3;
public const int SW_SHOW = 5;
public const int SW_MINIMIZE = 6;
public const int SW_SHOWMINNOACTIVE = 7;
public const int SW_RESTORE = 9;
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool UpdateWindow(IntPtr hWnd);