[英]UWP, Inject touch events Exception
Using InputInjector and InjectedInputTouchInfo to programmatically send touch events in windows 10 1709. I have been able to send mouse events using InjectMouseInput. 使用InputInjector和InjectedInputTouchInfo在Windows 10 1709中以编程方式发送触摸事件。我已经能够使用InjectMouseInput发送鼠标事件。 But When I tried to inject touch events, I am getting exception.
但是,当我尝试注入触摸事件时,我遇到了异常。 Code tried is same as provided by MSDN page
尝试的代码与MSDN页面提供的代码相同
inputInjector.InjectTouchInput(
new List<InjectedInputTouchInfo> {
new InjectedInputTouchInfo {
Contact = new InjectedInputRectangle
{
Top = 50,
Bottom = 50,
Left = 40,
Right = 40
},
PointerInfo = new InjectedInputPointerInfo {
PixelLocation = new InjectedInputPoint {
PositionX = 40, PositionY = 50
},
PointerOptions = InjectedInputPointerOptions.PointerUp,
PointerId = 1,
},
Pressure = 0.0,
TouchParameters =
InjectedInputTouchParameters.Pressure |
InjectedInputTouchParameters.Contact
}
});
executed this code gives exception. 执行此代码会给出异常。
{System.ArgumentException: Value does not fall within the expected range.
{System.ArgumentException:值不在预期范围内。 at Windows.UI.Input.Preview.Injection.InputInjector.InjectTouchInput(IEnumerable`1 input) }
在Windows.UI.Input.Preview.Injection.InputInjector.InjectTouchInput(IEnumerable`1 input)}
It seems it is issue with an update of Windows, Visual Studio or SDK. 似乎是Windows,Visual Studio或SDK更新的问题。 Your code seem correct.
您的代码似乎正确。
You can check [RS:1709][UWP][C#]InputInjector.InjectTouchInput - exception at MSDN Forums. 您可以在MSDN论坛上检查[RS:1709] [UWP] [C#] InputInjector.InjectTouchInput-异常 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.