diff --git a/src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs b/src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs
index 0a6e412f5bf8..1cbdbb628d2e 100644
--- a/src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs
+++ b/src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs
@@ -55,12 +55,6 @@ public static extern bool SetPropW(
IntPtr hData
);
- [DllImport("user32.dll")]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool GetCursorPos(
- out POINT point
- );
-
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr CreateEvent(
IntPtr lpEventAttributes,
diff --git a/src/Files.App/Helpers/Win32/Win32PInvoke.Structs.cs b/src/Files.App/Helpers/Win32/Win32PInvoke.Structs.cs
index 002112c0d814..584df725c71e 100644
--- a/src/Files.App/Helpers/Win32/Win32PInvoke.Structs.cs
+++ b/src/Files.App/Helpers/Win32/Win32PInvoke.Structs.cs
@@ -32,15 +32,6 @@ public struct RM_PROCESS_INFO
public bool bRestartable;
}
- [StructLayout(LayoutKind.Sequential)]
- public struct POINT
- {
- public int X;
- public int Y;
-
- public POINT(int x, int y) => (X, Y) = (x, y);
- }
-
[StructLayout(LayoutKind.Sequential)]
public struct BROWSEINFO
{
diff --git a/src/Files.App/UserControls/TabBar/TabBar.xaml.cs b/src/Files.App/UserControls/TabBar/TabBar.xaml.cs
index fa7babdfaea5..84283766d729 100644
--- a/src/Files.App/UserControls/TabBar/TabBar.xaml.cs
+++ b/src/Files.App/UserControls/TabBar/TabBar.xaml.cs
@@ -8,6 +8,8 @@
using Microsoft.UI.Xaml.Shapes;
using Windows.ApplicationModel.DataTransfer;
using Windows.Storage;
+using Windows.Win32;
+using Windows.Win32.Foundation;
namespace Files.App.UserControls.TabBar
{
@@ -58,7 +60,7 @@ public Rectangle DragArea
=> DragAreaRectangle;
/// Starting position when dragging a tab.
- private Win32PInvoke.POINT dragStartPoint;
+ private POINT dragStartPoint;
/// Starting time when dragging a tab.
private DateTimeOffset dragStartTime;
@@ -150,7 +152,7 @@ private void TabView_TabDragStarting(TabView sender, TabViewTabDragStartingEvent
args.Data.RequestedOperation = DataPackageOperation.Move;
// Get cursor position & time to track how far the tab was dragged.
- Win32PInvoke.GetCursorPos(out dragStartPoint);
+ PInvoke.GetCursorPos(out dragStartPoint);
dragStartTime = DateTimeOffset.UtcNow;
// Focus the UI Element, without this the focus sometimes changes
@@ -241,10 +243,10 @@ private async void TabView_TabDroppedOutside(TabView sender, TabViewTabDroppedOu
if (isCancelingDragOperation)
return;
- Win32PInvoke.GetCursorPos(out var droppedPoint);
+ PInvoke.GetCursorPos(out var droppedPoint);
var droppedTime = DateTimeOffset.UtcNow;
var dragTime = droppedTime - dragStartTime;
- var dragDistance = Math.Sqrt(Math.Pow((dragStartPoint.X - droppedPoint.X), 2) + Math.Pow((dragStartPoint.Y - droppedPoint.Y), 2));
+ var dragDistance = Math.Sqrt(Math.Pow(dragStartPoint.x - droppedPoint.x, 2) + Math.Pow(dragStartPoint.y - droppedPoint.y, 2));
if (sender.TabItems.Count == 1 ||
(dragTime.TotalSeconds < 1 &&
diff --git a/src/Files.App/Utils/Storage/Helpers/FilePropertiesHelpers.cs b/src/Files.App/Utils/Storage/Helpers/FilePropertiesHelpers.cs
index c4df858d5260..87004212c21f 100644
--- a/src/Files.App/Utils/Storage/Helpers/FilePropertiesHelpers.cs
+++ b/src/Files.App/Utils/Storage/Helpers/FilePropertiesHelpers.cs
@@ -11,6 +11,7 @@
using System.Collections.Concurrent;
using Windows.ApplicationModel;
using Windows.Graphics;
+using Windows.Win32;
namespace Files.App.Utils.Storage
{
@@ -136,14 +137,14 @@ public static void OpenPropertiesWindow(object item, IShellPage associatedInstan
new SuppressNavigationTransitionInfo());
// WINUI3: Move window to cursor position
- Win32PInvoke.GetCursorPos(out var pointerPosition);
- var displayArea = DisplayArea.GetFromPoint(new PointInt32(pointerPosition.X, pointerPosition.Y), DisplayAreaFallback.Nearest);
+ PInvoke.GetCursorPos(out var pointerPosition);
+ var displayArea = DisplayArea.GetFromPoint(new PointInt32(pointerPosition.x, pointerPosition.y), DisplayAreaFallback.Nearest);
var appWindowPos = new PointInt32
{
X = displayArea.WorkArea.X
- + Math.Max(0, Math.Min(displayArea.WorkArea.Width - appWindow.Size.Width, pointerPosition.X - displayArea.WorkArea.X)),
+ + Math.Max(0, Math.Min(displayArea.WorkArea.Width - appWindow.Size.Width, pointerPosition.x - displayArea.WorkArea.X)),
Y = displayArea.WorkArea.Y
- + Math.Max(0, Math.Min(displayArea.WorkArea.Height - appWindow.Size.Height, pointerPosition.Y - displayArea.WorkArea.Y)),
+ + Math.Max(0, Math.Min(displayArea.WorkArea.Height - appWindow.Size.Height, pointerPosition.y - displayArea.WorkArea.Y)),
};
if (App.AppModel.IncrementPropertiesWindowCount() == 1)