Share via


Enabling Mouse Keys (Windows Embedded CE 6.0)

1/6/2010

The mouse keys option enables the user to control the mouse pointer by using the numeric keypad. When the mouse keys option is active, the user can use the numeric keypad to control the movement mouse pointer, to click and double-click the mouse buttons, and to drag and drop items.

The user can control the settings for the mouse keys option by using the Mouse tab of the Accessibility Control Panel application or another application for customizing the environment.

Applications use the SPI_GETMOUSEKEYS and SPI_SETMOUSEKEYS flags with the SystemParametersInfo function to get and set the mouse keys option. The MOUSEKEYS structure defines the parameters for the mouse keys option. To set the mouse keys option, call SystemParametersInfo with the uiAction parameter set to SPI_SETMOUSEKEYS, the uiParam parameter set to the size of the MOUSEKEYS structure, and the pvParam parameter set to a pointer to a MOUSEKEYS structure that contains the mouse keys parameters that you want to use. You should set the MKF_MOUSEKEYSON flag in the dwFlags member of the MOUSEKEYS structure that you pass to SystemParametersInfo.

The following code example shows how to enable the mouse keys option.

MOUSEKEYS mkf;
BOOL bSuccess;

// Fill in the members of the MOUSEKEYS structure.

mkf.cbSize = sizeof(MOUSEKEYS);
mkf.dwFlags = (MKF_AVAILABLE | MKF_MOUSEKEYSON);
mkf.iMaxSpeed = 200;
mkf.iTimeToMaxSpeed = 1000;
mkf.iCtrlSpeed = 2;
mkf.dwReserved1 = 0;
mkf.dwReserved2 = 0;

// Call SystemParametersInfo with the SPI_SETMOUSEKEYS flag. 

bSuccess = SystemParametersInfo(SPI_SETMOUSEKEYS, sizeof(MOUSEKEYS), 
                                (LPVOID) &mkf, 0); 

To retrieve information about the mouse keys option, call SystemParametersInfo with uiAction set to SPI_GETMOUSEKEYS, uiParam set to the size of the MOUSEKEYS structure, and pvParam set to a pointer to a MOUSEKEYS structure. Examine the values of the members of the MOUSEKEYS structure after SystemParametersInfo returns to obtain the information that you want about the mouse keys option.

When MOUSEKEYS is enabled, keys on the numeric keypad produce activator and generator key functions. Activator keys specify which of the mouse buttons will perform an activity specified by one or more generator keys. Direction keys move the mouse cursor in a corresponding direction.

The following table describes the activator keys on the numeric keypad.

Activator Key Description

/ (Divisor key)

Specifies a LEFT button single or double-click will be used when subsequently pressing one of the generator keys.

* (Multiplier key)

Specifies a MIDDLE button single or double-click will be used when subsequently pressing one of the generator keys.

- (Minus key)

Specifies a RIGHT button single or double-click will be used when subsequently pressing one of the generator keys.

The following table describes the generator keys on the numeric keypad.

Generator Key Description

5

Generates a single-click.

+ (Plus key)

Generates a double-click.

0

Generates a mouse down event (press and hold).

. (Decimal point)

Generates a mouse up event (release button after a mouse down event).

The following table describes the direction keys on the numeric keypad.

Direction Key Direction

1

Moves the mouse cursor diagonally downward to the left.

2

Moves the mouse cursor down.

3

Moves the mouse cursor diagonally downward to the right.

4

Moves the mouse cursor to the left.

6

Moves the mouse cursor to the right.

7

Moves the mouse cursor diagonally upward to the left.

8

Moves the mouse cursor up.

9

Moves the mouse cursor diagonally upward to the right.

Examples

To generate a single left click followed by a double left click, use this sequence:

/ 5 +

To drag an object to the right, use this sequence:

/ 0 6 6 6 6 6 .

See Also

Concepts

Accessibility Hot Keys
Enabling Toggle Keys

Other Resources

Accessibility Application Development