How to Intercept touch input on Windows 8

2019-04-02 17:05发布

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.

0条回答
登录 后发表回答