简体   繁体   中英

Prevent touch input moving mouse cursor on Windows

I'm writing a C++ Win32 application that supports both mouse and touch input. However when I put my finger on the touchscreen, then the OS moves the mouse cursor into that position.

If I move the finger across the screen, and move the mouse at the same time, then OS will cause mouse cursor flickering, one frame it's under finger, 2nd frame under old mouse position.

I want the touch input to stop changing mouse cursor position. I want to keep the 2 inputs separate - touch not affecting the mouse. I want to keep reading 2 inputs at the same time - touch not affecting the mouse.

Here's a solution. Use WH_MOUSE_LL hook, and block mouse event cause by touching. Then compare MSLLHOOKSTRUCT->dwExtraInfo and 0xFF515700 to determine if it's a touch-caused mouse event.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM