Share via


Initializing the SDK

Before an application can accept input from multiple mouse devices, you must register the MultipointSdk object by associating it with a WPF window. This is best done as part of the Window.Loaded event of the primary window of your application, as described in the following procedure.

To initialize the MultiPoint Mouse SDK in an application

  1. Declare and set up a Window.Loaded event handler. Because the registration steps should only be performed after the window is loaded, you should include the registration steps in the Window.Loaded event handler.

  2. Call the Register method on the MultipointSdk object, passing in the active window. Separately, the MultiPoint Mouse assemblies perform the following actions:

    1. Register the active window to specify which window to monitor for MultiPoint Mouse events. Because the SDK needs the information about the parent window that is responsible for the graphics, you must register the active window before any device graphics are drawn for the mouse devices.

    2. Register mouse devices. This registration enumerates through all input devices attached to the computer, and builds a list of registered mouse devices that are available to the application.

    3. Draw a mouse device graphic for each attached mouse and assigns a default pointer to each.

    4. Hide the system pointer. In a MultiPoint Mouse application, the system pointer is not used for any of the attached devices, so it is hidden to avoid confusion.

The following example shows the registration procedure:

// 1. Set up the Window Loaded Event Handler and Initialize the SDK
private void Window1_Loaded(object sender, EventArgs e)
{
    // 2. Initialize the MultiPoint Mouse SDK
    MultipointSdk.Instance.Register(this);
}