共用方式為


Accessibility Hot Keys

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

An application can use the SystemParametersInfo function to enable or disable an accessibility option directly. For some of the options, you can use SystemParametersInfo to enable a hot key or key combination so the user can toggle the state of an option. The sound sentry option does not have a hot key. The following table shows the accessibility options that have hot keys.

Option Hot key

Mouse keys

Press Left ALT + Left SHIFT + NUM LOCK.

Sticky keys

Press the SHIFT key 5 times.

Toggle keys

Hold down the NUM LOCK key for 8 seconds.

High-contrast mode

Press Left ALT + Left SHIFT + PRINT SCREEN.

For an option that has a hot key, an application enables the hot key by setting the dwFlags member of the structure that corresponds that option to a value that enables the hot key and passing that structure to SystemParametersInfo. For example, an application can enable the hot key for the mouse keys option by setting the dwFlags member of a MOUSEKEYS structure to MKF_HOTKEYACTIVE and passing that structure to SystemParametersInfo with the uiAction parameter set to SPI_SETMOUSEKEYS and the uiParam parameter set to the size of the MOUSEKEYS structure.

The following code example shows how to enable the mouse keys option, enable the hot key for that option, and direct the OS to play a siren sound when the user turns the mouse keys option on or off by using the hot key.

MOUSEKEYS mkf;
BOOL bSuccess;

// Fill in the members of the MOUSEKEYS structure.

mkf.cbSize = sizeof(MOUSEKEYS);
mkf.dwFlags = (MKF_AVAILABLE | MKF_MOUSEKEYSON | MKF_HOTKEYACTIVE | 
               MKF_HOTKEYSOUND);
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); 

See Also

Concepts

Enabling Mouse Keys
Enabling Sticky Keys
Enabling Toggle Keys

Other Resources

Accessibility Application Development