Getting Started With Windows Multi Point Mouse SDK
Getting Started With Windows Multi Point Mouse SDK
Legal Information
This document is provided “as-is”. Information and views expressed in this document, including URL and other Internet Web site
references, may change without notice. You bear the risk of using it.
Some examples depicted herein are provided for illustration only and are fictitious. No real association or connection is intended or
should be inferred.
This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and
use this document for your internal, reference purposes.
Microsoft, C#, C++, Expression Blend, MultiPoint, .NET, Visual Basic, Visual Studio, Windows, and Windows Vista are trademarks
of the Microsoft group of companies.
CONTENTS
Introduction............................................................................................................................................. 3
Getting Started with the SDK .................................................................................................................. 3
Software Requirements ..................................................................................................................... 3
Installing the MultiPoint Mouse SDK .................................................................................................. 4
Referencing the Required Libraries ................................................................................................... 4
Initializing the MultiPoint Mouse SDK ................................................................................................ 4
Running Your Application .................................................................................................................. 5
Handling Mouse Addition and Removal ............................................................................................. 6
Building a MultiPoint Mouse-Enabled UI ................................................................................................ 7
Adding a MultiPoint Control ............................................................................................................... 7
Handling MultiPoint Mouse Clicks ...................................................................................................... 8
Determining Which Mouse Was Clicked ............................................................................................ 9
Customizing MultiPoint Mouse .............................................................................................................. 10
Assigning Pointer Colors ............................................................................................................ 10
Assigning Custom Images .......................................................................................................... 10
Freezing the Mouse Devices ........................................................................................................... 12
Advanced Topics .................................................................................................................................. 12
Excluding Pointers from a Region on the Screen ............................................................................. 12
Assigning Specific Mouse Functions (AKA Teacher Mouse) ............................................................ 12
Appendix A: Usage Scenarios .............................................................................................................. 13
The Map Sample Usage Scenario ................................................................................................... 13
The Quiz Sample Usage Scenario................................................................................................... 15
Introduction
The Windows® MultiPoint™ Mouse Software Development Kit (SDK) is a development framework that
allows developers to build applications that enable up to 25 individual mouse devices to work
simultaneously on one computer. As a developer, you can use the MultiPoint Mouse SDK to create
educational applications for schools with limited technological infrastructure, thus increasing the amount
of time any one student can spend on a computer. Initial pilot programs conducted in India by Microsoft®
Research show that for certain subjects, collaborative learning technologies like Windows MultiPoint help
1
enhance learning when compared to a 1:1 computing scenario .
MultiPoint Mouse SDK should not be confused with applications that allow multiple people to control
multiple mouse devices to perform standard operations. In those cases, the system traditionally cannot
identify which mouse has made which changes, and there is normally no option for controlling the
permissions of the various devices. MultiPoint Mouse SDK includes a development framework that
enables developers to build applications to take advantage of multiple mouse devices, including the ability
to handle mouse clicks from different users, independently, and to assign different permissions to each
mouse. For example, the mouse that a teacher uses in a learning application might need additional
permissions to control the activity.
This document will help you get started with the MultiPoint Mouse SDK by providing an overview of such
items as namespaces, classes, useful properties and functions, and by discussing common issues and
considerations for building applications by using MultiPoint Mouse SDK.
Software Requirements
The recommended programming environment is Microsoft Expression Blend® with Visual Studio 2008 or
Visual Studio 2010. Expression Blend is a graphical user interface (GUI) for designing interfaces. Visual
Studio provides a similar functionality, which, although not as rich in features as Expression Blend, should
be sufficient to develop applications with the MultiPoint Mouse SDK.
The following software is required to run the MultiPoint Mouse SDK:
If you are developing Windows Presentation Foundation applications, you should use Expression
Blend.
Note: The MultiPoint Mouse SDK will install the appropriate template for your version of Visual Studio.
1
The findings of Microsoft Research reports on the effects of collaborative technologies can be found on the MultiPoint Web site at
http://www.microsoft.com/unlimitedpotential/TransformingEducation/MultiPoint.mspx.
Note: The MultiPoint Mouse SDK does not support Windows Forms UI development.
The following additional folders are added to the installation location (by default, C:\Program
Files\Windows Multipoint Mouse SDK):
Bin: Contains the MultiPoint Mouse DLLs and a MSM merge file for use with MSI-based installers.
Docs: Contains the MultiPoint Mouse SDK documentation.
License: Contains license terms for using the SDK.
Samples: Contains all of the source code for the sample applications and the sample MultiPoint
Mouse control.
Microsoft.Multipoint.Sdk.dll
Microsoft.Multipoint.Sdk.Controls.dll
For a summary of the libraries and the classes that they contain, including useful methods and properties,
see the Overview of the SDK section below.
a. Registers the current window to specify to the SDK which window to monitor for MultiPoint Mouse
events. Because the SDK needs the information about the parent window that is responsible for
the visuals, you must register the current window before any device visuals are drawn for the
mouse devices.
b. Registers mouse devices. This registration enumerates through all input devices attached to the
computer, and builds a list of registered mouse devices available to the application.
Note: MultiPoint Mouse SDK does not recognize “track pads” on a laptop computer as an input device.
Therefore, you should use the USB mouse device to develop and test applications created by using
MultiPoint Mouse.
c. Draws a mouse device visual for each attached mouse device and assigns a default pointer to
each.
d. Hides the system pointer. In an application created using MultiPoint Mouse SDK, the system
pointer is not used for any of the attached devices, so it is hidden to avoid confusion.
MultipointSdk.Instance.DeviceArrivalEvent +=
MultipointDeviceArrivalEvent;
2. Set up the event handler function (as declared in parentheses in the previous code example) to
trigger the following event:
e.DeviceInfo.DeviceVisual.CursorBitmap = bitmap;
To see a complete example of how to manage pointers and assign them to new mouse devices, look at
Microsoft.Multipoint.Sdk.Samples.Common\CursorAssignments.cs.
You can also handle the removal of a mouse device in your code by using the DeviceRemovalEvent
handler. However, the SDK automatically removes the mouse and its associated pointer when the mouse
is disconnected. If you do not need to perform any custom operations when a mouse device is removed
and can safely omit this step.
using Microsoft.Multipoint.Sdk.Controls;
<Window
x:Class="MultipointBasicApp.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mp="clr-namespace:Microsoft.Multipoint.Sdk.Controls;
assembly=Microsoft.Multipoint.Sdk.Controls"
Title="Window1"
WindowState="Maximized">
Because the system pointer is not completely disabled, but rather just hidden, it is recommended that
you set the WindowState to “Maximized” to prevent the system pointer from being able to
inadvertently click on other windows when it is outside of the application window area.
3. Add a MultipointButton object to the window by adding the following code to the Window1.xaml file:
<Grid>
<mp:MultipointButton
Name="mpButton"
Content="Click Me"
Click="mpButton_Click" />
</Grid>
3. To get information about the mouse device that was clicked, cast the RoutedEventArgs to a
MultipointMouseEventArgs as follows:
MultipointMouseEventArgs multipointargs =
e as MultipointMouseEventArgs;
if (multipointargs != null)
{
// perform required action
}
5. To determine which mouse was clicked, view the Id property in the DeviceInfo object. You can output
this information to the button as follows:
mpButton.Content =
String.Format("Mouse #{0} Clicked me",
multipointargs.DeviceInfo.Id);
MultipointSdk.Instance.MouseDeviceList[0].DeviceVisual.
CursorColor = Colors.Red;
2. To access these resources as Bitmap objects, import the System.Drawing namespace, as follows:
using System.Drawing;
3. Create a new lookup function called GetCursorImage, passing in the ID. This function returns an
image instead of a color, as follows:
Advanced Topics
Excluding Pointers from a Region on the Screen
In the Quiz sample, the players are restricted to their own question region on the screen. When a player‟s
mouse attempts to exit this region, it is forced in again by calling the
MultipointMouseDevice.SetPosition method.
For details on this technique, see:
Microsoft.Multipoint.Sdk.Samples.Quiz.Model.PlayerManager.HandleMouseMovement.
Microsoft.Multipoint.Sdk.Samples.Map.WindowMain.OnKeyDown
Microsoft.Multipoint.Sdk.Samples.Map.WindowMain.OnMultipointMouseDown
Figure 1 shows the prompt “Where is Sydney?” above a map. Three customized pointers that correspond
to three players are visible on the map, and are also shown at the bottom of the screen in the Connected
Players List. The list on the right side displays the available activity options in the sample.
The application waits for each connected player to click the place on the map that matches the prompted
location. Once a player responds, the result is recorded and displayed on the Scoreboard on the left side
of the window. The Scoreboard shows the time it took for the student to choose a spot on the map to
click, and whether the answer was correct (green) or incorrect (red).
Once all of the connected players have responded to the question, a new prompt appears asking for the
location of another city. The process repeats until all locations within the activity are completed. The
teacher can move ahead to the next location at any time by clicking the Next Location button on the
screen. When an activity is finished, the application automatically proceeds to the next activity. Activities
also can be selected by clicking the Next Activity button on the screen.