簡體   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