Block the mouse keeping the stylus active

153 views Asked by At

I'm developing a C Windows forms application and I need to block every input from the keyboard and the mouse while the user is using the stylus on a Wacom tablet. I've tried using global mouse and keyboard hooks as described here to manage all the mouse and keyboard events generated by Windows and blocking the ones not generated by the stylus.

Everything is OK for the keyboard, but I'm not able to tell the source of mouse events. I've tried this kind of approach:

// [DllImport( "user32.dll" )]
// private static extern uint GetMessageExtraInfo( );

uint extra = GetMessageExtraInfo();
bool isPen = ( ( extra &  0xFFFFFF00 ) == 0xFF515700 );

as described here, but it doesn't work, since the value of extra is always 4283912448, reghardless of the source of the event.

Is there something I'm doing wrong?

0

There are 0 answers