SetSysColors

  BOOL SetSysColors(cDspElements, lpnDspElements, lpdwRgbValues)    
  int cDspElements; /* number of elements to change */
  CONST INT *lpnDspElements; /* address of array of elements */
  CONST COLORREF *lpdwRgbValues; /* address of array of RGB values */

The SetSysColors function sets the system colors for one or more display elements. Display elements are the various parts of a window and the Windows background that appear on the screen.

The SetSysColors function sends a WM_SYSCOLORCHANGE message to all windows to inform them of the change in color. It also directs Windows to repaint the affected portions of all currently visible windows.

Parameters

cDspElements

Specifies the number of display elements in the array pointed to by the lpnDspElements parameter.

lpnDspElements

Points to an array of integers that specify the display elements to be changed. For a list of possible display elements, see the following Comments section.

lpdwRgbValues

Points to an array of unsigned long integers that contains the new RGB (red-green-blue) color value for each display element in the array pointed to by the lpnDspElements parameter.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comments

The SetSysColors function changes the current Windows session only. The new colors are not saved when Windows terminates.

Following are the display elements that may be used in the lpnDspElements array:

Value Meaning

COLOR_ACTIVEBORDER Active window border.
COLOR_ACTIVECAPTION Active window caption.
COLOR_APPWORKSPACE Background color of multiple document interface (MDI) applications.
COLOR_BACKGROUND Desktop.
COLOR_BTNFACE Face shading on push buttons.
COLOR_BTNSHADOW Edge shading on push buttons.
COLOR_BTNTEXT Text on push buttons.
COLOR_CAPTIONTEXT Text in caption, size box, scroll-bar arrow box.
COLOR_GRAYTEXT Grayed (disabled) text. This color is set to 0 if the current display driver does not support a solid gray color.
COLOR_HIGHLIGHT Items selected item in a control.
COLOR_HIGHLIGHTTEXT Text of item selected in a control.
COLOR_INACTIVEBORDER Inactive window border.
COLOR_INACTIVECAPTION Inactive window caption.
COLOR_INACTIVECAPTIONTEXT Color of text in an inactive caption.
COLOR_MENU Menu background.
COLOR_MENUTEXT Text in menus.
COLOR_SCROLLBAR Scroll-bar gray area.
COLOR_SHADOW Color of automatic window shadows.
COLOR_WINDOW Window background.
COLOR_WINDOWFRAME Window frame.
COLOR_WINDOWTEXT Text in windows.

See Also

GetSysColor