How to Intercept touch input on Windows 8

谁说胖子不能爱 提交于 2019-12-05 06:51:55

问题


I'm writing Windows 8 desktop app and would like it to pop up when user taps the screen with (for example) 4 fingers. I've found this question:

How to detect tapping (touch input) globally instead of mouse clicking?

the answer offers 3 solutions. The first one is not good for me since I'd like to write app that works on each Win8 tablet.

The second one (RegisterPointerInputTarget) works excellent (my app intercepts all possible touch input, even when the start panel is active or a metro app is running), but the Windows itself begins to lack some touch capabilities (e.g. I cannot scroll the start panel with my finger anymore). I've tried to inject the touch input back, but with no luck at all:

if (message >= 0x0241 && message <= 0x024F)
{
    DWORD pointerID = LOWORD (wParam);
    POINTER_TOUCH_INFO pti;

    GetPointerTouchInfo (pointerID, &pti);
    InjectTouchInput (1, &pti);
}

(and yes, I've called InitializeTouchInjection (10, 0x3); before) Also, I personally don't like this way since the docs say that just one window can register itself for the pointer input. So I don't want my app to occupy such a resource.

The third solution (hooks) works good, but I cannot intercept touch from a metro app or the start panel.

Does anyone know how to correctly intercept all the touch input on Windows 8? uiAccess=true is not a problem, since my app will be signed. Thanks.

来源:https://stackoverflow.com/questions/16503236/how-to-intercept-touch-input-on-windows-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!