Reputation: 592
As of now, I can only listen to touch events within my app window via:
this.TouchDown += new EventHandler<TouchEventArgs>(TouchableThing_TouchDown);
this.TouchMove += new EventHandler<TouchEventArgs>(TouchableThing_TouchMove);
private void TouchableThing_TouchDown(object sender, TouchEventArgs e){}
private void TouchableThing_TouchMove(object sender, TouchEventArgs e){}
But I realized I needed to capture touch events outside the window too. Is there a known event where I could listen to such that it covers not only my own window, but the whole screen instead?
Upvotes: 0
Views: 453
Reputation: 6754
To get input events outside of the window, you need to delve into p/invoke territory. Specifically, you need to set up what's called a hook. Even more specifically, you need to add a WH_MOUSE hook, which lets you monitor system-wide mouse events (touch input is an evolution of mouse input so they are both handled together by Windows).
This question give valuable information and an example on interpreting touch input using a hook: how to distinguish touch vs mouse event from SetWindowsHookEx in c#
Upvotes: 1