Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C#
I want to handle two mices' click events in C#.
Posted 14-Mar-12 8:38am
Edited 14-Mar-12 9:00am
Ed Nutting34.5K
Wes Aday at 14-Mar-12 14:50pm
Why on earth would you want to do this at all?
ryanb31 at 14-Mar-12 14:55pm
Do you need to do something depending on which mouse it is? You do not have to code for this. Mouse clicks and moves will be registered as normal.
Ed Nutting at 14-Mar-12 15:03pm
Edit: Don't SHOUT - it's annoying and rude.
Furthermore, this is a demand for code/answer not a question. A question explains the problem, says what you have tried already, shows some effort has gone into solving it and then asks a specific and clear question and lastly, has a question mark. Your post fails all of this hence it is a demand. Please update your question to fix this issue, then someone might be able to help.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You don't. At least with the standard mouse drivers, Windows doesn't handle multiple mice, so your app can't do it either.
You can plug multiple mice into the machine, but you only have the one mouse pointer. If you move both mice, they will "fight" for control of the mouse pointer.
The only way to get multiple mouse pointers is if you use mouse drivers specifically written to handle this. For example, CPNMouse[^].
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Microsoft Mouse Mischief SDK, a free multi-mouse driver implemented as an add-in for PowerPoint, may shed some light on this topic. It appears that MS has figured out how to extract the HW device ID for each mouse and track them separately. I know several other groups (companies) have also figured out how to do this for their software apps. But I haven't developed the code myself yet. A quick glance over the MS SDK it appears that they are using the USB port related HW info, instead of the device-carried info, which may not be available anyway.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 554
1 Gihan Liyanage 338
2 RyanDev 268
3 Sergey Alexandrovich Kryukov 263
4 ChauhanAjay 220
0 Sergey Alexandrovich Kryukov 8,936
1 OriginalGriff 7,891
2 CPallini 2,603
3 Richard MacCutchan 2,121
4 Abhinav S 1,928

Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 10 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100