diff --git a/Sources/DesktopManager/MonitorNativeMethods.cs b/Sources/DesktopManager/MonitorNativeMethods.cs
index f62ef96..7433119 100644
--- a/Sources/DesktopManager/MonitorNativeMethods.cs
+++ b/Sources/DesktopManager/MonitorNativeMethods.cs
@@ -160,4 +160,10 @@ public static class MonitorNativeMethods {
///
public const int WS_MINIMIZE = 0x20000000;
public const int WS_MAXIMIZE = 0x01000000;
+
+ ///
+ /// Window position flags
+ ///
+ public const int SWP_NOZORDER = 0x0004;
+ public const int SWP_NOSIZE = 0x0001;
}
diff --git a/Sources/DesktopManager/WindowManager.cs b/Sources/DesktopManager/WindowManager.cs
index b17cd1b..f137f21 100644
--- a/Sources/DesktopManager/WindowManager.cs
+++ b/Sources/DesktopManager/WindowManager.cs
@@ -132,7 +132,7 @@ public void SetWindowPosition(WindowInfo windowInfo, int left, int top) {
top,
-1,
-1,
- 1)) {
+ MonitorNativeMethods.SWP_NOZORDER | MonitorNativeMethods.SWP_NOSIZE)) {
throw new InvalidOperationException("Failed to set window position");
}
}
@@ -146,11 +146,9 @@ public void SetWindowPosition(WindowInfo windowInfo, int left, int top) {
/// The width of the window. Use -1 to keep current width.
/// The height of the window. Use -1 to keep current height.
public void SetWindowPosition(WindowInfo windowInfo, int left, int top, int width = -1, int height = -1) {
- const int SWP_NOZORDER = 0x0004;
const int SWP_NOMOVE = 0x0002;
- const int SWP_NOSIZE = 0x0001;
- int flags = SWP_NOZORDER;
+ int flags = MonitorNativeMethods.SWP_NOZORDER;
// If position is -1, don't move
if (left < 0 && top < 0) {
@@ -159,7 +157,7 @@ public void SetWindowPosition(WindowInfo windowInfo, int left, int top, int widt
// If size is -1, don't resize
if (width < 0 && height < 0) {
- flags |= SWP_NOSIZE;
+ flags |= MonitorNativeMethods.SWP_NOSIZE;
}
if (!MonitorNativeMethods.SetWindowPos(