11using System ;
22using System . Runtime . InteropServices ;
33using System . Management ;
4+ using System . Windows . Interop ;
5+ using System . Windows ;
46
57namespace GenshinWoodmen . Core
68{
@@ -11,6 +13,9 @@ internal static class NativeMethods
1113
1214 public const int SC_RESTORE = 0xF120 ;
1315
16+ public const int GWL_EXSTYLE = - 20 ;
17+ public const int WS_EX_TOOLWINDOW = 0x00000080 ;
18+
1419 public const uint ES_AWAYMODE_REQUIRED = 0x00000040 ;
1520 public const uint ES_CONTINUOUS = 0x80000000 ;
1621 public const uint ES_DISPLAY_REQUIRED = 0x00000002 ;
@@ -112,6 +117,12 @@ internal static class NativeMethods
112117 [ DllImport ( "user32.dll" ) ]
113118 public static extern IntPtr MonitorFromPoint ( POINT pt , uint dwFlags ) ;
114119
120+ [ DllImport ( "user32.dll" ) ]
121+ public static extern int GetWindowLong ( IntPtr hWnd , int nIndex ) ;
122+
123+ [ DllImport ( "user32.dll" , CharSet = CharSet . Auto ) ]
124+ public static extern int SetWindowLong ( IntPtr hWnd , int nIndex , int dwNewLong ) ;
125+
115126 public static void Focus ( IntPtr hwnd )
116127 {
117128 _ = SendMessage ( hwnd , WM_SYSCOMMAND , SC_RESTORE , 0 ) ;
@@ -271,6 +282,14 @@ public static void SetBrightness(byte targetBrightness)
271282 break ;
272283 }
273284 }
285+
286+ public static void SetToolWindow ( IntPtr hwnd )
287+ {
288+ int style = ( int ) GetWindowLong ( hwnd , GWL_EXSTYLE ) ;
289+
290+ style |= WS_EX_TOOLWINDOW ;
291+ SetWindowLong ( hwnd , GWL_EXSTYLE , style ) ;
292+ }
274293 }
275294
276295 [ StructLayout ( LayoutKind . Sequential ) ]
0 commit comments