diff --git a/Wox/Helper/WindowIntelopHelper.cs b/Wox/Helper/WindowIntelopHelper.cs
new file mode 100644
index 0000000000..2e5179b7b4
--- /dev/null
+++ b/Wox/Helper/WindowIntelopHelper.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+namespace Wox.Helper
+{
+ public class WindowIntelopHelper
+ {
+ private const int GWL_STYLE = -16; //WPF's Message code for Title Bar's Style
+ private const int WS_SYSMENU = 0x80000; //WPF's Message code for System Menu
+
+ [DllImport("user32.dll", SetLastError = true)]
+ private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
+
+ [DllImport("user32.dll")]
+ private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
+
+ ///
+ /// disable windows toolbar's control box
+ /// this will also disable system menu with Alt+Space hotkey
+ ///
+ public static void DisableControlBox(Window win)
+ {
+ var hwnd = new System.Windows.Interop.WindowInteropHelper(win).Handle;
+ SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
+ }
+ }
+}
diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs
index c11ebf1a44..4256d4920f 100644
--- a/Wox/MainWindow.xaml.cs
+++ b/Wox/MainWindow.xaml.cs
@@ -90,6 +90,8 @@ namespace Wox
InitProgressbarAnimation();
//only works for win7+
//DwmDropShadow.DropShadowToWindow(this);
+
+ WindowIntelopHelper.DisableControlBox(this);
}
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj
index e2c64949b2..3cefced8cf 100644
--- a/Wox/Wox.csproj
+++ b/Wox/Wox.csproj
@@ -107,6 +107,7 @@
+
ProgramSourceSetting.xaml