OSDN Git Service

GUI: Added command-line option to force pure software rendering.
[slunkcrypt/SlunkCrypt.git] / gui / Utilities / WindowHelper.cs
index b8c85dd..48d65f0 100644 (file)
@@ -30,19 +30,19 @@ namespace com.muldersoft.slunkcrypt.gui.utils
             }
         }
 
-        public static void EnableResize(this Window window, bool enable)
+        public static void DisableMaximizeButton(this Window window)
         {
             if (!ReferenceEquals(window, null))
             {
                 const int GWL_STYLE = -16;
-                const uint WS_SIZEBOX = 0x40000;
+                const uint WS_MAXIMIZEBOX = 0x10000;
                 try
                 {
                     WindowInteropHelper interopHelper = new WindowInteropHelper(window);
                     uint value = NativeMethods.GetWindowLong(interopHelper.Handle, GWL_STYLE);
-                    if (value != 0)
+                    if ((value & WS_MAXIMIZEBOX) != 0U)
                     {
-                        NativeMethods.SetWindowLong(interopHelper.Handle, GWL_STYLE, enable ? (value | WS_SIZEBOX) : (value & (~WS_SIZEBOX)));
+                        NativeMethods.SetWindowLong(interopHelper.Handle, GWL_STYLE, value & (~WS_MAXIMIZEBOX));
                     }
                 }
                 catch { }