diff --git a/src/common/Common.UI/Common.UI.csproj b/src/common/Common.UI/Common.UI.csproj index da57190dc8..72bd622b6e 100644 --- a/src/common/Common.UI/Common.UI.csproj +++ b/src/common/Common.UI/Common.UI.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/modules/colorPicker/ColorPickerUI/ColorEditorWindow.xaml.cs b/src/modules/colorPicker/ColorPickerUI/ColorEditorWindow.xaml.cs index 6a2329a5fd..5a893953e7 100644 --- a/src/modules/colorPicker/ColorPickerUI/ColorEditorWindow.xaml.cs +++ b/src/modules/colorPicker/ColorPickerUI/ColorEditorWindow.xaml.cs @@ -31,7 +31,7 @@ namespace ColorPicker protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); - NativeMethods.SetPopupStyle(this); + NativeMethods.SetToolWindowStyle(this); } } } diff --git a/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj b/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj index b235b9f125..eecfd86a79 100644 --- a/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj +++ b/src/modules/colorPicker/ColorPickerUI/ColorPickerUI.csproj @@ -59,7 +59,7 @@ - + diff --git a/src/modules/colorPicker/ColorPickerUI/NativeMethods.cs b/src/modules/colorPicker/ColorPickerUI/NativeMethods.cs index a67b0efdf7..39332bd1f9 100644 --- a/src/modules/colorPicker/ColorPickerUI/NativeMethods.cs +++ b/src/modules/colorPicker/ColorPickerUI/NativeMethods.cs @@ -15,8 +15,8 @@ namespace ColorPicker // will have to rename public static class NativeMethods { - private const int GWL_STYLE = -16; - private const int WS_POPUP = 1 << 31; // 0x80000000 + private const int GWL_EX_STYLE = -20; + private const int WS_EX_TOOLWINDOW = 0x00000080; [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Interop")] @@ -180,10 +180,10 @@ namespace ColorPicker [DllImport("user32.dll")] internal static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); - internal static void SetPopupStyle(Window win) + internal static void SetToolWindowStyle(Window win) { var hwnd = new WindowInteropHelper(win).Handle; - _ = SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) | WS_POPUP); + _ = SetWindowLong(hwnd, GWL_EX_STYLE, GetWindowLong(hwnd, GWL_EX_STYLE) | WS_EX_TOOLWINDOW); } } } diff --git a/src/modules/imageresizer/ui/ImageResizerUI.csproj b/src/modules/imageresizer/ui/ImageResizerUI.csproj index 180f5a1e25..95ea69d79a 100644 --- a/src/modules/imageresizer/ui/ImageResizerUI.csproj +++ b/src/modules/imageresizer/ui/ImageResizerUI.csproj @@ -64,7 +64,7 @@ all - + all diff --git a/src/modules/launcher/PowerLauncher/Helper/WindowsInteropHelper.cs b/src/modules/launcher/PowerLauncher/Helper/WindowsInteropHelper.cs index f5741b614e..4c0819f203 100644 --- a/src/modules/launcher/PowerLauncher/Helper/WindowsInteropHelper.cs +++ b/src/modules/launcher/PowerLauncher/Helper/WindowsInteropHelper.cs @@ -14,14 +14,13 @@ using Point = System.Windows.Point; namespace PowerLauncher.Helper { + [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Matching COM")] public static class WindowsInteropHelper { - [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Matching COM")] private const int GWL_STYLE = -16; // WPF's Message code for Title Bar's Style - [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Matching COM")] + private const int GWL_EX_STYLE = -20; private const int WS_SYSMENU = 0x80000; // WPF's Message code for System Menu - [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Matching COM")] - private const int WS_POPUP = 1 << 31; // 0x80000000 + private const int WS_EX_TOOLWINDOW = 0x00000080; private static IntPtr _hwnd_shell; private static IntPtr _hwnd_desktop; @@ -172,12 +171,12 @@ namespace PowerLauncher.Helper } /// - /// Set WS_POPUP to make FancyZones ignoring the Window + /// Set WS_EX_TOOLWINDOW to make FancyZones ignoring the Window /// - public static void SetPopupStyle(Window win) + internal static void SetToolWindowStyle(Window win) { var hwnd = new WindowInteropHelper(win).Handle; - _ = NativeMethods.SetWindowLong(hwnd, GWL_STYLE, NativeMethods.GetWindowLong(hwnd, GWL_STYLE) | WS_POPUP); + _ = NativeMethods.SetWindowLong(hwnd, GWL_EX_STYLE, NativeMethods.GetWindowLong(hwnd, GWL_EX_STYLE) | WS_EX_TOOLWINDOW); } /// diff --git a/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs b/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs index 74e735617f..f6fc74457e 100644 --- a/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs +++ b/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs @@ -78,7 +78,7 @@ namespace PowerLauncher protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); - WindowsInteropHelper.SetPopupStyle(this); + WindowsInteropHelper.SetToolWindowStyle(this); } private void CheckForFirstDelete(object sender, ElapsedEventArgs e) diff --git a/src/modules/launcher/PowerLauncher/PowerLauncher.csproj b/src/modules/launcher/PowerLauncher/PowerLauncher.csproj index d0dc395ea6..efaca84773 100644 --- a/src/modules/launcher/PowerLauncher/PowerLauncher.csproj +++ b/src/modules/launcher/PowerLauncher/PowerLauncher.csproj @@ -101,7 +101,7 @@ - + diff --git a/src/settings-ui/PowerToys.Settings/OobeWindow.xaml.cs b/src/settings-ui/PowerToys.Settings/OobeWindow.xaml.cs index fc2a4ed7c1..ca101b6fcc 100644 --- a/src/settings-ui/PowerToys.Settings/OobeWindow.xaml.cs +++ b/src/settings-ui/PowerToys.Settings/OobeWindow.xaml.cs @@ -89,7 +89,7 @@ namespace PowerToys.Settings { base.OnSourceInitialized(e); var hwnd = new WindowInteropHelper(this).Handle; - NativeMethods.SetPopupStyle(hwnd); + NativeMethods.SetToolWindowStyle(hwnd); } } } diff --git a/src/settings-ui/Settings.UI/Helpers/NativeMethods.cs b/src/settings-ui/Settings.UI/Helpers/NativeMethods.cs index a3750322a4..327a6f9828 100644 --- a/src/settings-ui/Settings.UI/Helpers/NativeMethods.cs +++ b/src/settings-ui/Settings.UI/Helpers/NativeMethods.cs @@ -5,13 +5,14 @@ using System; using System.Runtime.InteropServices; using System.Text; +using Windows.UI.Xaml; namespace Microsoft.PowerToys.Settings.UI.Helpers { public static class NativeMethods { - private const int GWL_STYLE = -16; - private const int WS_POPUP = 1 << 31; // 0x80000000 + private const int GWL_EX_STYLE = -20; + private const int WS_EX_TOOLWINDOW = 0x00000080; internal const int SPI_GETDESKWALLPAPER = 0x0073; [DllImport("user32.dll")] @@ -44,9 +45,9 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool SystemParametersInfo(int uiAction, int uiParam, StringBuilder pvParam, int fWinIni); - public static void SetPopupStyle(IntPtr hwnd) + public static void SetToolWindowStyle(IntPtr hwnd) { - _ = SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) | WS_POPUP); + _ = SetWindowLong(hwnd, GWL_EX_STYLE, GetWindowLong(hwnd, GWL_EX_STYLE) | WS_EX_TOOLWINDOW); } } }