繁体   English   中英

Windows 10 放大镜 API 鼠标点击坏了?

[英]Windows 10 Magnifier API mouse clicking broken?

我使用windows magnifier api在autohotkey中创建了一个以鼠标为中心的放大镜。 在 Windows 7 中完成,在新的 Windows 8、8.1 甚至 10 LTSB 上工作。 但它似乎在 Windows 10 创作者更新、红石 3 更新、Windows 10 红石 4 和现在的 Windows 10 红石 5 更新中出现故障。当然,没有找到答案。

问题是,在放大时,单击屏幕的某个位置会导致单击位置好像它不在那里、在屏幕外或不在任何地方,使窗口散焦。

我使用来自https://code.msdn.microsoft.com/windowsdesktop/Magnification-API-Sample-14269fd2的放大镜 api 示例进行了测试,还使用下面的简单 C# 控制台应用程序进行了测试;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Runtime.InteropServices;

namespace Magnifier
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(MagInitialize());
            Console.WriteLine(MagSetFullscreenTransform(4.0f, 0, 0));
            Console.ReadLine();
            MagUninitialize();
        }

        [DllImport("Magnification.dll")]
        public static extern bool MagInitialize();

        [DllImport("Magnification.dll")]
        public static extern bool MagSetFullscreenTransform(float a, int b, int d);

        [DllImport("Magnification.dll")]
        public static extern bool MagUninitialize();

        [DllImport("Magnification.dll")]
        public static extern bool MagShowSystemCursor(bool a);
    }
}

我在另一台安装了 windows 10 redstone 4 的电脑上测试过,还是一样。

任何人都知道它是怎么回事,为什么会发生,以及如何解决它?

好的,经过这么长时间,我发现了这里的问题。

在 Windows 10 的一些新的主要更新之后,函数“MagSetInputTransform”也开始以一种被窃听的方式影响鼠标。

需要 UIA 访问才能使此功能正常工作,这很麻烦,但我正在处理 Autohotkey。

; offset_x and offset_y is the magnification origin (top-left)
; SM_CXVIRTUALSCREEN and SM_CYVIRTUALSCREEN is the maximum screen size
; If A_LastError returns 5, it means access denied and needs UIA permission (beyond administrator permission, so it won't work with just administrator privilege)

VarSetCapacity(rect_source, 16)
VarSetCapacity(rect_destination, 16)

NumPut(offset_x, rect_source, 0, "Int")
NumPut(offset_y, rect_source, 4, "Int")
NumPut(offset_x + SM_CXVIRTUALSCREEN / zoom_factor, rect_source, 8, "Int")
NumPut(offset_y + SM_CYVIRTUALSCREEN / this.zoom_factor, rect_source, 12, "Int")

NumPut(0, rect_destination, 0, "Int")
NumPut(0, rect_destination, 4, "Int")
NumPut(0 + SM_CXVIRTUALSCREEN, rect_destination, 8, "Int")
NumPut(0 + SM_CYVIRTUALSCREEN, rect_destination, 12, "Int")

If (!DllCall("Magnification.dll\MagSetInputTransform", "Int", 1, "Ptr", &rect_source, "Ptr", &rect_destination))
     Msgbox, % "Magnifier`nError " A_LastError)

有关其他信息,我无法在放大时使用我的 Wacom 绘图板,因为它会因使用此 MagSetInputTransform 而出错。 我还没有发现解决这个问题。

希望这一点信息可以帮助任何遇到的人。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM