Enabling Toggle Keys

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

The toggle keys option provides sound feedback when the user turns on or off the CAPS LOCK, NUM LOCK, or SCROLL LOCK key. When the toggle keys option is on, the Windows Embedded CE-based device emits a high-pitched sound whenever the user turns on the CAPS LOCK, NUM LOCK, or SCROLL LOCK key and emits a low-pitched sound whenever the user turns off one of these keys.

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

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

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

TOGGLEKEYS tkf;
BOOL bSuccess;

// Fill in the members of the TOGGLEKEYS structure.

tkf.cbSize = sizeof(TOGGLEKEYS);
tkf.dwFlags = (TKF_AVAILABLE | TKF_TOGGLEKEYSON);

// Call SystemParametersInfo with the SPI_SETTOGGLEKEYS flag. 

bSuccess = SystemParametersInfo(SPI_SETTOGGLEKEYS, sizeof(TOGGLEKEYS), 
                                (LPVOID) &tkf, 0); 

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

See Also

Concepts

Enabling Sticky Keys
Accessibility Hot Keys

Other Resources

Accessibility Application Development