SetSysColors

Syntax

void SetSysColors(nChanges,lpSysColor,lpColorValues)

This function sets the system colors for one or more display elements. Display elements are the various parts of a window and the Windows display that appear on the system display screen. The SetSysColors function changes the number of elements specified by the nChanges parameter, using the color and system-color index contained in the arrays pointed to by the lpSysColor and lpColorValues parameters.

SetSysColors 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.

Parameter Type/Description  

nChanges int Specifies the number of system colors to be changed.  
lpSysColor LPINT Points to an array of integer indexes that specify the elements to be changed. The index values that can be used are listed in Table R.17, “System Color Indexes.”  
lpColorValues DWORD FAR * Points to an array of unsigned long integers that contains the new RGB color values for each element.  

Return Value

None.

Comments

SetSysColors changes the internal system list only. It does not change the [COLORS] section of the Windows initialization file, WIN.INI. Changes apply to the current Windows session only. System colors are a shared resource. An application should not change a color if it does not wish to change colors for all windows in all currently running applications. System colors for monochrome displays are usually interpreted as various shades of gray. Table R.17 lists the values for the lpSysColor parameter:

Table R.17 System Color Indexes

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.

Table R.17 System Color Indexes (continued)

Value Meaning

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_MENU Menu background.
COLOR_MENUTEXT Text in menus.
COLOR_SCROLLBAR Scroll-bar gray area.
COLOR_WINDOW Window background.
COLOR_WINDOWFRAME Window frame.
COLOR_WINDOWTEXT Text in windows.