繁体   English   中英

Win32笔模拟不适用于InjectTouchInput()

[英]Win32 pen simulation not working with InjectTouchInput()

我在Windows 10桌面上使用win32 touchinjection。

我已经尝试了两天来进行笔模拟。

下面的代码与PointerInputType.Touch一起使用,但是我需要压力和方向,但这似乎不起作用。

GetLastError()返回87,这意味着参数错误,但是我尝试了我能想到的每对参数。

       InitializeTouchInjection();

        pointer = new PointerTouchInfo();

        pointer.PointerInfo.PointerId = 1;
        pointer.PointerInfo.pointerType = PointerInputType.PEN;            

        pointer.TouchMasks = TouchMask.PRESSURE | TouchMask.ORIENTATION;
    //  pointer.TouchMasks =  TouchMask.CONTACTAREA | TouchMask.ORIENTATION | TouchMask.PRESSURE;
        pointer.Pressure = 1024;
        pointer.Orientation = 90;

   //   pointer.PointerInfo.PtHimetricLocation.X = 50;
   //   pointer.PointerInfo.PtHimetricLocation.Y = 200;
        pointer.PointerInfo.PtPixelLocation.X = 50;
        pointer.PointerInfo.PtPixelLocation.Y = 200;          

        pointer.PointerInfo.PointerFlags = PointerFlags.INCONTACT |PointerFlags.INRANGE| PointerFlags.DOWN;

        var a1=InjectTouchInput(1, new[] { pointer });
        var b1 = GetLastError();
        int errCode = Marshal.GetLastWin32Error();

我将如何获得此工作或进一步调试的任何信息将不胜感激。

有一个新的InjectSyntheticPointerInput API非常相似, InjectTouchInput支持笔和触摸。 无法使用C#或.NET,但我想可以用相同的方式公开它。 唯一的问题是Windows 10 1809及更高版本仅支持该版本,因此您至少需要该版本的Windows SDK(仅支持Visual Studio 2017,不支持2015,FYI)。

暂无
暂无

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

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