diff --git a/src/Files.App.CsWin32/NativeMethods.txt b/src/Files.App.CsWin32/NativeMethods.txt index aee2e82f99b3..ba743b7c4fe8 100644 --- a/src/Files.App.CsWin32/NativeMethods.txt +++ b/src/Files.App.CsWin32/NativeMethods.txt @@ -97,7 +97,6 @@ SendMessage IsWindowVisible COPYDATASTRUCT WINDOW_LONG_PTR_INDEX -GetDpiForWindow CallWindowProc MINMAXINFO SUBCLASSPROC diff --git a/src/Files.App/Data/Models/AppModel.cs b/src/Files.App/Data/Models/AppModel.cs index 63577cfd65c6..8b7e213ab34a 100644 --- a/src/Files.App/Data/Models/AppModel.cs +++ b/src/Files.App/Data/Models/AppModel.cs @@ -4,6 +4,8 @@ using Microsoft.UI.Xaml.Controls; using System.Runtime.InteropServices; using Windows.ApplicationModel.DataTransfer; +using Windows.Win32; +using Windows.Win32.Foundation; namespace Files.App.Data.Models { @@ -127,9 +129,8 @@ public string PCloudDrivePath /// /// Gets or sets a value indicating the AppWindow DPI. - /// TODO update value if the DPI changes /// - private float _AppWindowDPI = Win32PInvoke.GetDpiForWindow(MainWindow.Instance.WindowHandle) / 96f; + private float _AppWindowDPI = PInvoke.GetDpiForWindow((HWND)MainWindow.Instance.WindowHandle) / 96f; public float AppWindowDPI { get => _AppWindowDPI; diff --git a/src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs b/src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs index 9af7345111ec..3c85c9ab7445 100644 --- a/src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs +++ b/src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs @@ -76,11 +76,6 @@ public static extern bool SetEvent( IntPtr hEvent ); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - public static extern int GetDpiForWindow( - IntPtr hwnd - ); - [DllImport("ole32.dll")] public static extern uint CoWaitForMultipleObjects( uint dwFlags,