Capture touch input on the screen in windows device

前端 未结 1 867
难免孤独
难免孤独 2021-01-27 17:39

Is there any way to capture touch input on the screen (outside application frame) in windows device?

I\'m working on a WPF application and can retrieve the touch input i

1条回答
  •  走了就别回头了
    2021-01-27 18:14

    There's no built-in method of the WPF framework that lets you listen for input outside of the application. If you want to do that, you'll have to get into p/invoke territory.

    Specifically you'll need to create a hook. You'll want to look at the SetWindowsHookEx method and either the WH_MOUSE or WH_MOUSE_LL hooks.

    Since you're dealing with touch inputs, this answer might have some useful information for you:

    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.

    0 讨论(0)
提交回复
热议问题