Using InputInjector and InjectedInputTouchInfo to programmatically send touch events in windows 10 1709. I have been able to send mouse events using InjectMouseInput. But When I tried to inject touch events, I am getting exception. Code tried is same as provided by MSDN page
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. at Windows.UI.Input.Preview.Injection.InputInjector.InjectTouchInput(IEnumerable`1 input) }
It seems it is issue with an update of Windows, Visual Studio or SDK. Your code seem correct.
You can check [RS:1709][UWP][C#]InputInjector.InjectTouchInput - exception at MSDN Forums.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.