fix: 桌面拾取脚本补 DPI 感知,修复混合缩放下坐标错位

This commit is contained in:
yu 2026-10-30 14:16:34 +08:00
parent 8de4791e57
commit 4ad238ff37

View File

@ -7,6 +7,9 @@ function Write-PickLog([string]$msg) {
}
Write-PickLog ("=== start Mode=$Mode ===")
Add-Type -AssemblyName UIAutomationClient, UIAutomationTypes, WindowsBase
Add-Type -MemberDefinition "[DllImport("user32.dll")] public static extern bool SetProcessDpiAwarenessContext(IntPtr value);" -Name PickDpi -Namespace RpaPick | Out-Null
try { [RpaPick.PickDpi]::SetProcessDpiAwarenessContext([IntPtr](-4)) | Out-Null } catch {}
Write-PickLog "dpi aware set"
Add-Type -AssemblyName System.Windows.Forms
Write-PickLog "assemblies ok"
Add-Type -MemberDefinition '[DllImport("user32.dll")] public static extern short GetAsyncKeyState(int key); [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern int GetWindowTextW(IntPtr h, System.Text.StringBuilder sb, int max); [DllImport("user32.dll")] public static extern int GetWindowLong(IntPtr hWnd, int nIndex); [DllImport("user32.dll")] public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);' -Name PickW32 -Namespace RpaPick | Out-Null