I am attempting to control two "mice". The primary mouse (mice) are used for controlling the cursor for normal UI control (which I don't want to intercept) and a secondary "mouse" which should only be used as input into the application I am writing and ignored otherwise.
I am successfully capturing the mouse messages and filtering as desired. I can also successfully capture the mouse inputs,even when my app is not in focus (as desired).
The only remaining issue is that I can't seem to keep the mouse from interacting with other applications. So I can essentially spy on the mouse, but not fully consume the message.
I "believe" I am preventing the "base.WndProc(ref message)" from getting called when I am processing the filtered mouse messages, but the system still seems to be getting the mouse clicks.
Is C# (Visual Studio Express 2010) able to do this?
Thank you for any assistance you might be able to give.
Raw input might be what you're looking for. Here is an MSDN discussion with a similar question which has link to a codeproject article on handling mutliple keyboards in C#.
You can use global mouse hook. I don't remember where I've found it, but here is the sample
As others have stated this is at the very least troublesome in dot net. I would highly recommend you switch over to C++ / Win32 to achieve this. I think you will save yourself a lot of headache in the long run.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With