Skip to content

Commit

Permalink
[Oobe]Fix close button style (#16530)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimecbernardo authored Feb 23, 2022
1 parent d5fc454 commit 50a7396
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/settings-ui/PowerToys.Settings/OobeWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);
var hwnd = new WindowInteropHelper(this).Handle;
NativeMethods.SetToolWindowStyle(hwnd);
NativeMethods.SetPopupStyle(hwnd);
}
}
}
8 changes: 4 additions & 4 deletions src/settings-ui/Settings.UI/Helpers/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
{
public static class NativeMethods
{
private const int GWL_EX_STYLE = -20;
private const int WS_EX_TOOLWINDOW = 0x00000080;
private const int GWL_STYLE = -16;
private const int WS_POPUP = 1 << 31; // 0x80000000
internal const int SPI_GETDESKWALLPAPER = 0x0073;

[DllImport("user32.dll")]
Expand Down Expand Up @@ -45,9 +45,9 @@ public static class NativeMethods
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool SystemParametersInfo(int uiAction, int uiParam, StringBuilder pvParam, int fWinIni);

public static void SetToolWindowStyle(IntPtr hwnd)
public static void SetPopupStyle(IntPtr hwnd)
{
_ = SetWindowLong(hwnd, GWL_EX_STYLE, GetWindowLong(hwnd, GWL_EX_STYLE) | WS_EX_TOOLWINDOW);
_ = SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) | WS_POPUP);
}
}
}

0 comments on commit 50a7396

Please sign in to comment.