Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/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 Mousetab of the AccessibilityControl Panel application or another application for customizing the environment.

Applications use the SPI_GETMOUSEKEYS and SPI_SETMOUSEKEYS flags with the SystemParametersInfofunction to get and set the mouse keys option. The MOUSEKEYSstructure defines the parameters for the mouse keys option. To set the mouse keys option, call SystemParametersInfowith the uiActionparameter set to SPI_SETMOUSEKEYS, the uiParamparameter set to the size of the MOUSEKEYSstructure, and the pvParamparameter set to a pointer to a MOUSEKEYSstructure that contains the mouse keys parameters that you want to use. You should set the MKF_MOUSEKEYSON flag in the dwFlagsmember of the MOUSEKEYSstructure that you pass to SystemParametersInfo.

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

Copy Code
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 SystemParametersInfowith uiActionset to SPI_GETMOUSEKEYS, uiParamset to the size of the MOUSEKEYSstructure, and pvParamset to a pointer to a MOUSEKEYSstructure. Examine the values of the members of the MOUSEKEYSstructure after SystemParametersInforeturns 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