Sets the colors for the specified display elements. Display elements are the various parts of a window and the display that appear on the system display screen.
Syntax
BOOL WINAPI SetSysColors(
__in int cElements,
__in const INT *lpaElements,
__in const COLORREF *lpaRgbValues
);
Parameters
- cElements [in]
-
The number of display elements in the lpaElements array.
- lpaElements [in]
-
A pointer to an array of integers that specify the display elements to be changed. For a list of display elements, see
GetSysColor.
- lpaRgbValues [in]
-
A pointer to an array of
COLORREF values that contain the new red, green, blue (RGB) color values for the display elements in the array pointed to by the lpaElements parameter.
To generate a
COLORREF, use the
RGB macro.
Return Value
If the function succeeds, the return value is a nonzero value.
If the function fails, the return value is zero. To get extended error information, call
GetLastError.
Remarks
The
SetSysColors function sends a
WM_SYSCOLORCHANGE message to all windows to inform them of the change in color. It also directs the system to repaint the affected portions of all currently visible windows.
It is best to respect the color settings specified by the user. If you are writing an application to enable the user to change the colors, then it is appropriate to use this function. However, this
function affects only the current session. The new colors are not saved when the system terminates.
Examples
For an example, see
Changing the Colors of Window Elements.
Requirements
| Minimum supported client | Windows 2000 Professional |
| Minimum supported server | Windows 2000 Server |
| Header | Winuser.h (include Windows.h) |
| Library | User32.lib |
| DLL | User32.dll |
See Also
- GetSysColor
- COLORREF
- RGB
- System Information Functions
Send comments about this topic to Microsoft
Build date: 5/14/2009