Click to Rate and Give Feedback
MSDN
MSDN Library
System Services
System Information
 SetSysColors Function

  Switch on low bandwidth view
SetSysColors Function

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

C++
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 clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinuser.h (include Windows.h)
LibraryUser32.lib
DLLUser32.dll

See Also

GetSysColor
COLORREF
RGB
System Information Functions

Send comments about this topic to Microsoft

Build date: 5/14/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker