C # Suppress mouse click for multiple mice

I wrote an application that currently handles clicks from multiple mouse devices.

I used this project and was modified to handle mouse clicks as shown on the keyboard.

This works great, however now I need to know if there is a way to suppress the click event if it was handled by my application. The app is a quiz game, so the idea is that the quiz master will have (and still use) 1 mouse and the other participants will have their own mouse (like buzzers). So when they buzz, I don't want the operating system (or at least this app) to trigger mouse click events.

The concept is the familiar void WndProc (ref message message) override , and so I tried not to call base.WndProc (ref Message) when I don't know if I want the click events to fire, but that didn't work.

Can anyone point me in the right direction?

Should I go down the windows hook route ? I've looked at this, but I can't figure out how I can connect to each mouse device individually.

Any help would be greatly appreciated.

Edit:

This is a Windows Form UI project, not WPF. Therefore, Microsoft's MultiPoint SDK will not work.

+3


source to share


1 answer


The solution to this lies not in WndProc, but in PreFilterMessage (). By intercepting messages before they even reach the form, you can remove them from the message pump so they never reach the control that was clicked. This also works for child controls on a form.

I answered this and posted the full source in the following question:



C # Get mouse handle (GetRawInputDeviceInfo)

+1


source







All Articles