Enabling High Contrast (Windows Embedded CE 6.0)

1/6/2010

The high-contrast option indicates whether an application should use a high contrast between the colors used for foreground and background visuals.

The user can control the setting of the high-contrast option by using the Display tab of the Accessibility Control Panel application or another application for customizing the environment. Applications use the SPI_GETHIGHCONTRAST and SPI_SETHIGHCONTRAST flags with the SystemParametersInfo function to get and set the high-contrast option.

Both when an application initializes and when it processes WM_SYSCOLORCHANGE messages, the application should determine the state of the high-contrast option. To make this determination, the application should call SystemParametersInfo with the uiAction parameter set to SPI_GETHIGHCONTRAST flag and the uiParam parameter set to the size of the HIGHCONTRAST structure to obtain a HIGHCONTRAST structure. If the value of the dwFlags member of the HIGHCONTRAST structure includes the HCF_HIGHCONTRASTON flag, then the high-contrast option is enabled. When the high-contrast option is enabled, an application should perform the following tasks to ensure maximum visibility of the user interface for users with low vision:

  • Map all colors to a single pair of foreground and background colors. Use the GetSysColor function to determine the appropriate foreground and background colors, using either a combination of COLOR_WINDOWTEXT and COLOR_WINDOW or a combination of COLOR_BTNTEXT and COLOR_BTNFACE. The GetSysColor function returns the colors that the user selected through the Accessibility Control Panel.
  • Omit any bitmapped images that you display in the background behind text. Such images visually distract a user who needs high contrast.
  • Draw images that you would usually draw in multiple colors by using only the foreground and background colors selected for text.

An application can turn on the high-contrast option by calling SystemParametersInfo with uiAction set to SPI_SETHIGHCONTRAST, uiParam set to the size of the HIGHCONTRAST structure, and the pvParam parameter set to a pointer to a HIGHCONTRAST structure that contains the high-contrast parameters that you want to use. You should set the HCF_HIGHCONTRASTON flag in the dwFlags member of the ACCESSTIMEOUT structure that you pass to SystemParametersInfo.

The following code example shows how to enable the high-contrast option and set the color scheme to high-contrast white.

HIGHCONTRAST hcf;
BOOL bSuccess;

// Fill in the members of the HIGHCONTRAST structure.

hcf.cbSize = sizeof(HIGHCONTRAST);
hcf.dwFlags = (HCF_AVAILABLE | HCF_HIGHCONTRASTON);
hcf.lpszDefaultScheme = TEXT("High Contrast White");

// Call SystemParametersInfo with the SPI_SETHIGHCONTRAST flag. 

bSuccess = SystemParametersInfo(SPI_SETHIGHCONTRAST, sizeof(HIGHCONTRAST),
                                (LPVOID) &hcf, 0); 

See Also

Other Resources

Accessibility Application Development