Skip to content

Commit b7aaa85

Browse files
committed
Code Quality: Replaced private const & struct with CsWin32
1 parent 29a3ce5 commit b7aaa85

File tree

3 files changed

+3
-48
lines changed

3 files changed

+3
-48
lines changed

src/Files.App.CsWin32/NativeMethods.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,5 @@ IApplicationDocumentLists
160160
ApplicationDocumentLists
161161
IApplicationActivationManager
162162
MENU_ITEM_TYPE
163+
WM_WINDOWPOSCHANGING
164+
WINDOWPOS

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

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -16,51 +16,5 @@ 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-
}
6519
}
6620
}

src/Files.App/MainWindow.xaml.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,10 +357,9 @@ public bool SetCanWindowToFront(bool canWindowToFront)
357357
}
358358
}
359359

360-
private const int WM_WINDOWPOSCHANGING = 0x0046;
361360
private void WindowManager_WindowMessageReceived(object? sender, WinUIEx.Messaging.WindowMessageEventArgs e)
362361
{
363-
if ((!CanWindowToFront) && e.Message.MessageId == WM_WINDOWPOSCHANGING)
362+
if ((!CanWindowToFront) && e.Message.MessageId == Windows.Win32.PInvoke.WM_WINDOWPOSCHANGING)
364363
{
365364
Win32Helper.ForceWindowPosition(e.Message.LParam);
366365
e.Handled = true;

0 commit comments

Comments
 (0)