views:

4239

answers:

6

Is there a way to accept input from more than one mouse separately? I'm interested in making a multi-user application and I thought it would be great if I could have 2 or more users holding wireless mice each interacting with the app individually with a separate mouse arrow.

Is this something I should try to farm out to some other application/driver/os_magic? or is there a library I can use to accomplish this? Language isn't a HUGE deal, but C, C++, and Python are preferrable.

Thanks :)

edit:

Found this multi-pointer toolkit for linux (it's actually a multi-pointer x server): http://wearables.unisa.edu.au/mpx/

+5  A: 

Yes. I know of at least one program that does this, KidPad. I think it's written in Java and was developed by Juan Pablo Hourcade, now at the University of Iowa. You'd have to ask him how it was implemented.

tvanfosson
+1  A: 

You could use DirectInput with C/C++ (there's probably also bindings in other languages). You use IDirectInput8::EnumDevices() (using DX8; same function, different interface in other versions of DirectX) to get a list of all attached devices. Then, you create the devices and poll them IDirectInputDevice8::Poll(). This should almost definitely work with any number of mice, keyboards, and other input devices. MSDN has really good documentation on this.

Adam Rosenfield
This will not work on Windows XP, you should use RawInput instead. See here: http://jstookey.com/arcade/rawmouse/
kshahar
+1  A: 

I have this vague feeling that BeOS used to let one pair a mouse and keyboard and have separate active windows and inputs. Wow... that was a long time ago. I thought that it would be very interesting for "paired" programming.

+8  A: 

You could try the Microsoft Windows MultiPoint Software Development Kit 1.1

or the new Microsoft Windows MultiPoint Software Development Kit 1.5

and the main Microsoft Multipoint site

ShoeLace
This link is broken - can someone with sufficient rep fix it?
Erik Forbes
it works fine for me now.. so either someone fixed it or it was just temporary.
ShoeLace
+1  A: 

See my answer here (avoid the JNI stuff): http://stackoverflow.com/questions/262125/java-multiple-mouse-inputs#263886

kshahar
+2  A: 

http://code.google.com/p/pymultimouse/ is a library using windows raw input, it worked in a test with 2 mice.