title: Selectively giving control to mouse input devices
body: <p>I want to develop a multiple mouse input tool for Windows, with the ability to selectively give control to an individual mouse device. I would also like to track MouseMove events of devices for which click events are disabled and display a pointer.</p>
  
  <p>The closest existing solution I am aware of (for Win7) is <a href="http://www.dicolab.com/wunderworks/" rel="nofollow">TeamPlayer</a>, but it lacks the functionality to restrict control to an individual mouse (or customize cursor images), instead freely transferring control with a left click. I have tried manually disabling devices by DeviceID, but once re-enabled TeamPlayer will not recognise them. Additionally, many of my mouse devices have the same DeviceID.</p>
  
  <p>I have been considering Microsoft's MultiPoint SDK, having already developed an interactive multi-mouse game in Unity3D using MultiPoint TUIO (a multi-touch TUIO framework simulator for the MultiPoint SDK) and Mindstorm's Unity3D-TUIO.</p>
  
  <p>MultiPoint TUIO uses a MultiPoint overlay window and sends TUIO messages to the underlying target window. However, I see problems with this kind of approach (i.e. routing <a href="http://msdn.microsoft.com/en-us/library/microsoft.multipoint.sdk.multipointmouseevents_members" rel="nofollow">MultipointMouseEvents</a>) to control the pointer in non-MultiPoint windows. For example, a click event would take focus away from the MultiPoint window, returning control to all input devices.</p>
  
  <p>Can anyone suggest a better approach?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Regarding use of MultiPoint in Unity, I found adapting MultiPoint TUIO was overkill but used the same approach.</p>
  
  <p>I created an application (in WPF) implementing a UDP server and a transparent window registered with MultiPoint, which would position and size itself to exactly overlay a Unity window. [Note: you must enable "Run in Background" in the Unity Player settings.]</p>
  
  <p>Then I streamed the MultiPoint mouse positions and events to a <code>UdpClient</code> receiver in Unity, in a class called <code>MultiPointInput</code>, which keeps track of the states in static members. Then a particular mouse position, for example, is accessed with <code>MultiPointInput.mousePosition(mouseID)</code> (analogously to <code>Input.mousePosition</code>).</p>
  
  <p>I have successfully used it in the classroom with 15-20 wireless mice. The SDK is very stable, but there are insidious hardware issues when using more than a few wireless mice (varying ranges and interference).</p>