11using System ;
22using System . Runtime . InteropServices ;
3+ using System . Windows ;
4+ using System . Windows . Interop ;
35
46namespace EnhancePoE . Utils ;
57
68internal static class Win32
79{
810 public const int WS_EX_TRANSPARENT = 0x00000020 ;
11+ public const int WS_EX_TOOLWINDOW = 0x00000080 ;
912 public const int GWL_EXSTYLE = - 20 ;
1013
1114 [ DllImport ( "user32.dll" ) ]
@@ -14,15 +17,25 @@ internal static class Win32
1417 [ DllImport ( "user32.dll" ) ]
1518 public static extern int SetWindowLong ( IntPtr hwnd , int index , int newStyle ) ;
1619
17- public static void MakeTransparent ( IntPtr hwnd )
20+ public static void MakeTransparent ( Window window )
1821 {
22+ var hwnd = new WindowInteropHelper ( window ) . Handle ;
1923 int extendedStyle = GetWindowLong ( hwnd , GWL_EXSTYLE ) ;
2024 _ = SetWindowLong ( hwnd , GWL_EXSTYLE , extendedStyle | WS_EX_TRANSPARENT ) ;
2125 }
2226
23- public static void MakeNormal ( IntPtr hwnd )
27+ public static void MakeNormal ( Window window )
2428 {
29+ var hwnd = new WindowInteropHelper ( window ) . Handle ;
2530 int extendedStyle = GetWindowLong ( hwnd , GWL_EXSTYLE ) ;
2631 _ = SetWindowLong ( hwnd , GWL_EXSTYLE , extendedStyle & ~ WS_EX_TRANSPARENT ) ;
2732 }
33+
34+ // Ensures window does not show up in Alt+Tab or Win+Tab UI
35+ public static void MakeToolWindow ( Window window )
36+ {
37+ var hwnd = new WindowInteropHelper ( window ) . Handle ;
38+ int extendedStyle = GetWindowLong ( hwnd , GWL_EXSTYLE ) ;
39+ _ = SetWindowLong ( hwnd , GWL_EXSTYLE , extendedStyle | WS_EX_TOOLWINDOW ) ;
40+ }
2841}
0 commit comments