共用方式為


Setting Accessibility Time-out Periods

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

You should use the accessibility time-out option for computers that several users with different accessibility preferences share. Each user can use hot keys or the Accessibility Control Panel to enable preferred functionality. The accessibility time-out period is the length of time that must pass without keyboard or mouse input before the operating system (OS) automatically turns off accessibility functionality. The time-out affects the following accessibility functionality: mouse keys, sticky keys, toggle keys, and high contrast.

The user can control the settings for the accessibility time-out option by using the General tab of the Accessibility Control Panel application or another application for customizing the environment.

Applications use the SPI_GETACCESSTIMEOUT and SPI_SETACCESSTIMEOUT flags with the SystemParametersInfo function to get and set the accessibility time-out option. The ACCESSTIMEOUT structure defines the parameters for the accessibility time-out option. To set the accessibility time-out option, call SystemParametersInfo with the uiAction parameter set to SPI_SETACCESSTIMEMOUT, the uiParam parameter set to the size of the ACCESSTIMEOUT structure, and the pvParam parameter set to a pointer to an ACCESSTIMEOUT structure that contains the new time-out parameters that you want to use. You should set the ATF_TIMEOUTON flag in the dwFlags member of the ACCESSTIMEOUT structure that you pass to SystemParametersInfo and set the iTimeOutMSec member to the length of the time-out period in milliseconds.

The following code example shows how to set the accessibility time-out period to 10 minutes and how to specify that the OS should play a descending siren sound when the time-out period elapses and the OS turns off the accessibility options.

ACCESSTIMEOUT atf;
BOOL bSuccess;

// Fill in the members of the ACCESSTIMEOUT structure.

atf.cbSize = sizeof(ACCESSTIMEOUT);
atf.dwFlags = (ATF_ONOFFFEEDBACK | ATF_TIMEOUTON);
atf.iTimeOutMSec = 600000;

// Call SystemParametersInfo with the SPI_SETACCESSTIMEOUT flag. 

bSuccess = SystemParametersInfo(SPI_SETACCESSTIMEOUT, 
                                sizeof(ACCESSTIMEOUT), (LPVOID) &atf, 0); 

To retrieve information about the time-out period, including whether a time-out period is set and the length of the time-out period, call SystemParametersInfo with uiAction set to SPI_GETACCESSTIMEOUT, uiParam set to the size of the ACCESSTIMEOUT structure, and pvParam set to a pointer to an ACCESSTIMEOUT structure. Examine the values of the members of the ACCESSTIMEOUT structure after SystemParametersInfo returns to obtain the information that you want about the accessibility time-out option.

See Also

Other Resources

Accessibility Application Development