processing two mouse events - is this possible?

Started by
11 comments, last by Evil Steve 14 years, 1 month ago
Hello, When attaching two USB mice to a single computer, the mouse events are aggregated to reflect movement in the single cursor. Is there a way to log the amount of movement each mouse attributes to the final cursor movement. For example, when the cursor has moved 1000 pixels in a given direction, is there a way to log the individual input from Mouse 1 and Mouse 2 which corresponded in this movement?
Advertisement
What platform / API / language? This might be possible with DirectInput; the DirectX Caps Viewer (Which comes with the DirectX SDK) will be able to tell you (Since there'll be more than one mouse visible there).

For Win32, and I believe SDL on Windows (Although I'm not entirely sure), the OS combines all mouse input into one device, so you won't be able to do it.
You should be able to use Raw Input to get data from each mouse separately.
Quote:Original post by mattd
You should be able to use Raw Input to get data from each mouse separately.


Thanks! but Raw Mouse Input just returns x and y based on the single mouse cursor position. I guess I need each mouse's movement information regardless of the "unified" cursor.

Are you sure? You should be able to enumerate two seperate devices, register for raw input messages on both, and be able to tell which mouse is doing the moving when one moves.

This site thinks so too..
Quote:Original post by mattd
Are you sure? You should be able to enumerate two seperate devices, register for raw input messages on both, and be able to tell which mouse is doing the moving when one moves.

This site thinks so too..


Thanks, Mattd again.

Then what is lLastX and lLastY of RAW MOUSE INPUT http://msdn.microsoft.com/en-us/library/ms645578(VS.85).aspx ? I though they are the relative x and y values based on the current mouse position (each mouse). Am I wrong? Anybody knows what this values come from?







As per that page, it's the "signed relative motion or absolute motion, depending on the value of usFlags", for one of your mice. I imagine you get packets that correspond to both mice and something in each packet tells you which one it came from.

You seem to be posting stuff in disbelief without actually trying it. I will tell you now, that raw input is made to allow this and there would be nothing else on Windows that will. So what are you waiting for? Start using it!
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms
Quote:Original post by iMalc
As per that page, it's the "signed relative motion or absolute motion, depending on the value of usFlags", for one of your mice. I imagine you get packets that correspond to both mice and something in each packet tells you which one it came from.

You seem to be posting stuff in disbelief without actually trying it. I will tell you now, that raw input is made to allow this and there would be nothing else on Windows that will. So what are you waiting for? Start using it!


Thanks, iMalc! No I've already tried RAW MOUSE INPUT stuffs. Just not sure what its lLastX and lLastY values are exactly and how I should make use of them to measure two different mouse movements. That's my question.
Here is a web page with a few samples (even a wrapper) for this. Look at these and you will see how they are used for relative, absolute, etc.

http://www.jstookey.com/arcade/rawmouse/

Please note though that this is only supported under Windows XP!
-It's available in Windows XP and up; sorry about that.


[EDIT]
Perhaps the Windows MultiPoint Mouse SDK is a great solution for what you are trying to accomplish? It states that it's used for WPF, but it's .NET so it's worth a shot. It allows up to 25 mouse devices at once...

http://www.microsoft.com/multipoint/mouse-sdk/developer.aspx

[Edited by - UltimaX on February 17, 2010 12:26:13 PM]
Quote:Original post by UltimaX
Here is a web page with a few samples (even a wrapper) for this. Look at these and you will see how they are used for relative, absolute, etc.

http://www.jstookey.com/arcade/rawmouse/

Please note though that this is only supported under Windows XP!

Windows XP is the minimum version that supports Raw Input, not the only version. (Check MSDN)

This topic is closed to new replies.

Advertisement