Skip to content

Commit 1aa2cd6

Browse files
committed
Code Quality: Replace Vanara with CsWin32
1 parent 7dc84ef commit 1aa2cd6

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

src/Files.App.CsWin32/Windows.Win32.Extras.cs

+46
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,51 @@ namespace UI.WindowsAndMessaging
1616
{
1717
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
1818
public delegate LRESULT WNDPROC(HWND hWnd, uint msg, WPARAM wParam, LPARAM lParam);
19+
20+
/// <summary>Contains information about the size and position of a window.</summary>
21+
/// <remarks>
22+
/// <para><see href="https://learn.microsoft.com/windows/win32/api/winuser/ns-winuser-windowpos">Learn more about this API from docs.microsoft.com</see>.</para>
23+
/// </remarks>
24+
public partial struct WINDOWPOS
25+
{
26+
/// <summary>
27+
/// <para>Type: <b>HWND</b> A handle to the window.</para>
28+
/// <para><see href="https://learn.microsoft.com/windows/win32/api/winuser/ns-winuser-windowpos#members">Read more on docs.microsoft.com</see>.</para>
29+
/// </summary>
30+
internal HWND hwnd;
31+
32+
/// <summary>
33+
/// <para>Type: <b>HWND</b> The position of the window in Z order (front-to-back position). This member can be a handle to the window behind which this window is placed, or can be one of the special values listed with the <a href="https://docs.microsoft.com/windows/desktop/api/winuser/nf-winuser-setwindowpos">SetWindowPos</a> function.</para>
34+
/// <para><see href="https://learn.microsoft.com/windows/win32/api/winuser/ns-winuser-windowpos#members">Read more on docs.microsoft.com</see>.</para>
35+
/// </summary>
36+
internal HWND hwndInsertAfter;
37+
38+
/// <summary>
39+
/// <para>Type: <b>int</b> The position of the left edge of the window.</para>
40+
/// <para><see href="https://learn.microsoft.com/windows/win32/api/winuser/ns-winuser-windowpos#members">Read more on docs.microsoft.com</see>.</para>
41+
/// </summary>
42+
internal int x;
43+
44+
/// <summary>
45+
/// <para>Type: <b>int</b> The position of the top edge of the window.</para>
46+
/// <para><see href="https://learn.microsoft.com/windows/win32/api/winuser/ns-winuser-windowpos#members">Read more on docs.microsoft.com</see>.</para>
47+
/// </summary>
48+
internal int y;
49+
50+
/// <summary>
51+
/// <para>Type: <b>int</b> The window width, in pixels.</para>
52+
/// <para><see href="https://learn.microsoft.com/windows/win32/api/winuser/ns-winuser-windowpos#members">Read more on docs.microsoft.com</see>.</para>
53+
/// </summary>
54+
internal int cx;
55+
56+
/// <summary>
57+
/// <para>Type: <b>int</b> The window height, in pixels.</para>
58+
/// <para><see href="https://learn.microsoft.com/windows/win32/api/winuser/ns-winuser-windowpos#members">Read more on docs.microsoft.com</see>.</para>
59+
/// </summary>
60+
internal int cy;
61+
62+
/// <summary>Type: <b>UINT</b></summary>
63+
public SET_WINDOW_POS_FLAGS flags;
64+
}
1965
}
2066
}

src/Files.App/Helpers/Win32/Win32Helper.WindowManagement.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using System.Runtime.InteropServices;
88
using Windows.Win32;
99
using Windows.Win32.UI.WindowsAndMessaging;
10-
using static Vanara.PInvoke.User32;
1110

1211
namespace Files.App.Helpers
1312
{
@@ -68,7 +67,7 @@ public static void ChangeCursor(this UIElement uiElement, InputCursor cursor)
6867
public static void ForceWindowPosition(nint lParam)
6968
{
7069
var windowPos = Marshal.PtrToStructure<WINDOWPOS>(lParam);
71-
windowPos.flags |= SetWindowPosFlags.SWP_NOZORDER;
70+
windowPos.flags |= SET_WINDOW_POS_FLAGS.SWP_NOZORDER;
7271
Marshal.StructureToPtr(windowPos, lParam, false);
7372
}
7473
}

0 commit comments

Comments
 (0)