在 windows 台设备的屏幕上捕获触摸输入

Capture touch input on the screen in windows device

有什么方法可以在 windows 设备的屏幕上(应用程序框架外)捕获触摸输入吗?

我正在开发一个 WPF 应用程序,如果触摸输入仅发生在应用程序框架内,我可以检索它。另外,有没有办法在应用程序最小化时注册触摸输入?

WPF 框架没有内置方法可让您侦听应用程序外部的输入。如果你想这样做,你必须进入 p/invoke 领域。

具体来说,您需要创建一个 hook. You'll want to look at the SetWindowsHookEx method and either the WH_MOUSE or WH_MOUSE_LL 挂钩。

由于您正在处理触摸输入, 可能有一些对您有用的信息:

The lParam argument of your hookProc callback is a pointer to an MSLLHOOKSTRUCT. It contains a very poorly documented dwExtraInfo variable, which tells you whether it was generated from a touch.

If all of the bits in 0xFF515700 are set in dwExtraInfo, then the callback was invoked in response to a touch.