@@ -132,12 +132,12 @@ public static void HideFromAltTab(Window window)
132132 {
133133 var hwnd = GetWindowHandle ( window ) ;
134134
135- var exStyle = GetCurrentWindowStyle ( hwnd , WINDOW_LONG_PTR_INDEX . GWL_EXSTYLE ) ;
135+ var exStyle = GetWindowStyle ( hwnd , WINDOW_LONG_PTR_INDEX . GWL_EXSTYLE ) ;
136136
137137 // Add TOOLWINDOW style, remove APPWINDOW style
138138 var newExStyle = ( ( uint ) exStyle | ( uint ) WINDOW_EX_STYLE . WS_EX_TOOLWINDOW ) & ~ ( uint ) WINDOW_EX_STYLE . WS_EX_APPWINDOW ;
139139
140- SetWindowLong ( hwnd , WINDOW_LONG_PTR_INDEX . GWL_EXSTYLE , ( int ) newExStyle ) ;
140+ SetWindowStyle ( hwnd , WINDOW_LONG_PTR_INDEX . GWL_EXSTYLE , ( int ) newExStyle ) ;
141141 }
142142
143143 /// <summary>
@@ -148,12 +148,12 @@ public static void ShowInAltTab(Window window)
148148 {
149149 var hwnd = GetWindowHandle ( window ) ;
150150
151- var exStyle = GetCurrentWindowStyle ( hwnd , WINDOW_LONG_PTR_INDEX . GWL_EXSTYLE ) ;
151+ var exStyle = GetWindowStyle ( hwnd , WINDOW_LONG_PTR_INDEX . GWL_EXSTYLE ) ;
152152
153153 // Remove the TOOLWINDOW style and add the APPWINDOW style.
154154 var newExStyle = ( ( uint ) exStyle & ~ ( uint ) WINDOW_EX_STYLE . WS_EX_TOOLWINDOW ) | ( uint ) WINDOW_EX_STYLE . WS_EX_APPWINDOW ;
155155
156- SetWindowLong ( GetWindowHandle ( window ) , WINDOW_LONG_PTR_INDEX . GWL_EXSTYLE , ( int ) newExStyle ) ;
156+ SetWindowStyle ( GetWindowHandle ( window ) , WINDOW_LONG_PTR_INDEX . GWL_EXSTYLE , ( int ) newExStyle ) ;
157157 }
158158
159159 /// <summary>
@@ -164,14 +164,14 @@ public static void DisableControlBox(Window window)
164164 {
165165 var hwnd = GetWindowHandle ( window ) ;
166166
167- var style = GetCurrentWindowStyle ( hwnd , WINDOW_LONG_PTR_INDEX . GWL_STYLE ) ;
167+ var style = GetWindowStyle ( hwnd , WINDOW_LONG_PTR_INDEX . GWL_STYLE ) ;
168168
169169 style &= ~ ( int ) WINDOW_STYLE . WS_SYSMENU ;
170170
171- SetWindowLong ( hwnd , WINDOW_LONG_PTR_INDEX . GWL_STYLE , style ) ;
171+ SetWindowStyle ( hwnd , WINDOW_LONG_PTR_INDEX . GWL_STYLE , style ) ;
172172 }
173173
174- private static int GetCurrentWindowStyle ( HWND hWnd , WINDOW_LONG_PTR_INDEX nIndex )
174+ private static int GetWindowStyle ( HWND hWnd , WINDOW_LONG_PTR_INDEX nIndex )
175175 {
176176 var style = PInvoke . GetWindowLong ( hWnd , nIndex ) ;
177177 if ( style == 0 && Marshal . GetLastPInvokeError ( ) != 0 )
@@ -181,11 +181,11 @@ private static int GetCurrentWindowStyle(HWND hWnd, WINDOW_LONG_PTR_INDEX nIndex
181181 return style ;
182182 }
183183
184- private static int SetWindowLong ( HWND hWnd , WINDOW_LONG_PTR_INDEX nIndex , int dwNewLong )
184+ private static nint SetWindowStyle ( HWND hWnd , WINDOW_LONG_PTR_INDEX nIndex , int dwNewLong )
185185 {
186186 PInvoke . SetLastError ( WIN32_ERROR . NO_ERROR ) ; // Clear any existing error
187187
188- var result = PInvoke . SetWindowLong ( hWnd , nIndex , dwNewLong ) ;
188+ var result = PInvoke . SetWindowLongPtr ( hWnd , nIndex , dwNewLong ) ;
189189 if ( result == 0 && Marshal . GetLastPInvokeError ( ) != 0 )
190190 {
191191 throw new Win32Exception ( Marshal . GetLastPInvokeError ( ) ) ;
@@ -299,14 +299,14 @@ public static Point TransformPixelsToDIP(Visual visual, double unitX, double uni
299299
300300 #region WndProc
301301
302- public static bool WM_ENTERSIZEMOVE ( int msg )
302+ public static bool WM_ENTERSIZEMOVE ( uint msg )
303303 {
304- return msg == ( int ) PInvoke . WM_ENTERSIZEMOVE ;
304+ return msg == PInvoke . WM_ENTERSIZEMOVE ;
305305 }
306306
307- public static bool WM_EXITSIZEMOVE ( int msg )
307+ public static bool WM_EXITSIZEMOVE ( uint msg )
308308 {
309- return msg == ( int ) PInvoke . WM_EXITSIZEMOVE ;
309+ return msg == PInvoke . WM_EXITSIZEMOVE ;
310310 }
311311
312312 #endregion
0 commit comments