This commit is contained in:
qhy040404
2024-06-26 11:27:54 +08:00
parent 0075d79b0c
commit 0c1968ff49
2 changed files with 9 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ internal sealed class NotifyIconXamlHostWindow : Window, IWindowNeedEraseBackgro
Content = new Border();
this.SetLayered();
this.SetToolWindow();
AppWindow.Title = "SnapHutaoNotifyIconXamlHost";
AppWindow.IsShownInSwitchers = false;

View File

@@ -97,6 +97,14 @@ internal static class WindowExtension
}
}
public static void SetToolWindow(this Window window)
{
HWND hwnd = (HWND)WindowNative.GetWindowHandle(window);
nint style = GetWindowLongPtrW(hwnd, WINDOW_LONG_PTR_INDEX.GWL_EXSTYLE);
style |= (nint)WINDOW_EX_STYLE.WS_EX_TOOLWINDOW;
SetWindowLongPtrW(hwnd, WINDOW_LONG_PTR_INDEX.GWL_EXSTYLE, style);
}
public static unsafe void BringToForeground(this Window window)
{
HWND fgHwnd = GetForegroundWindow();