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 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 Displaytab of the AccessibilityControl Panel application or another application for customizing the environment. Applications use the SPI_GETHIGHCONTRAST and SPI_SETHIGHCONTRAST flags with the SystemParametersInfofunction 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 SystemParametersInfowith the uiActionparameter set to SPI_GETHIGHCONTRAST flag and the uiParamparameter set to the size of the HIGHCONTRASTstructure to obtain a HIGHCONTRASTstructure. If the value of the dwFlagsmember of the HIGHCONTRASTstructure 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 GetSysColorfunction 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 GetSysColorfunction returns the colors that the user selected through the AccessibilityControl 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 SystemParametersInfowith uiActionset to SPI_SETHIGHCONTRAST, uiParamset to the size of the HIGHCONTRASTstructure, and the pvParamparameter set to a pointer to a HIGHCONTRASTstructure that contains the high-contrast parameters that you want to use. You should set the HCF_HIGHCONTRASTON flag in the dwFlagsmember of the ACCESSTIMEOUTstructure 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.

Copy Code
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