WinSetSysColors

This function sets system color values.

Syntax
WinSetSysColors(hwndDeskTop, flOptions, ulFormat, lStart, ulTablen, alTable)

Parameters

 * hwndDeskTop (HWND) - input:Desktop-window handle.
 * HWND_DESKTOP: The desktop-window handle
 * Other: Specified desktop-window handle.


 * flOptions (ULONG) - input:Options.
 * LCOL_RESET: The system colors are all to be reset to default before processing the remainder of the data in this function.
 * LCOL_PURECOLOR: Color-dithering should not be used to create colors not available in the physical palette. If this option is set, only pure colors are used and no dithering is done.


 * ulFormat (ULONG) - input: Format of entries in the table, as follows.
 * LCOLF_INDRGB: Array of (index,RGB) values. Each pair of entries is 8-bytes long, comprising 4 bytes for the index, and 4 bytes for the color value. For system color indexes, see lStart.
 * LCOLF_CONSECRGB: Array of (RGB) values, corresponding to color indexes lStart upwards. Each entry is 4-bytes long.


 * lStart (LONG) - input:Starting system color index.
 * This parameter is applicable only if the ulFormat parameter is set to LCOLF_CONSECRGB.
 * The number of system colors (as defined below) is given by SYSCLR_CSYSCOLORS.
 * The following system color indexes are defined (each successive index is one larger than its predecessor):
 * SYSCLR_ENTRYFIELD: Entry field and list box background color.
 * SYSCLR_MENUDISABLEDTEXT: Entry field background color.
 * SYSCLR_MENUHILITE: Selected menu item text.
 * SYSCLR_MENUHILITEBGND: Selected menu item background.
 * SYSCLR_PAGEBACKGROUND: Notebook page background.
 * SYSCLR_FIELDBACKGROUND: Inactive scroll bar and default control background color.
 * SYSCLR_BUTTONLIGHT: Light push button (3D effect).
 * SYSCLR_BUTTONMIDDLE: Middle push button (3D effect).
 * SYSCLR_BUTTONDARK: Dark push button (3D effect).
 * SYSCLR_BUTTONDEFAULT: Push button.
 * SYSCLR_TITLEBOTTOM: Line drawn under title bar.
 * SYSCLR_SHADOW: Drop shadow for menus and dialogs.
 * SYSCLR_ICONTEXT: Text written under icons on the desktop.
 * SYSCLR_DIALOGBACKGROUND: Pop up dialog box background.
 * SYSCLR_HILITEFOREGROUND: Selection foreground.
 * SYSCLR_HILITEBACKGROUND: Selection background.
 * SYSCLR_INACTIVETITLETEXTBKGD: Background of inactive title text.
 * SYSCLR_ACTIVETITLETEXTBKGD: Background of active title text.
 * SYSCLR_INACTIVETITLETEXT: Inactive title text.
 * SYSCLR_ACTIVETITLETEXT: Active title text.
 * SYSCLR_OUTPUTTEXT: Output text.
 * SYSCLR_WINDOWSTATICTEXT: Static (nonselectable) text.
 * SYSCLR_SCROLLBAR: Active scroll bar background area.
 * SYSCLR_BACKGROUND: Desktop background.
 * SYSCLR_ACTIVETITLE: Active window title.
 * SYSCLR_INACTIVETITLE: Inactive window title.
 * SYSCLR_MENU: Menu background.
 * SYSCLR_WINDOW: Window background.
 * SYSCLR_WINDOWFRAME: Window frame (border line).
 * SYSCLR_MENUTEXT: Normal menu item text.
 * SYSCLR_WINDOWTEXT: Window text.
 * SYSCLR_TITLETEXT: Text in title bar, size box, scroll bar arrow box.
 * SYSCLR_ACTIVEBORDER: Border fill of active window.
 * SYSCLR_INACTIVEBORDER: Border fill of inactive window.
 * SYSCLR_APPWORKSPACE: Background of specific main windows.
 * SYSCLR_HELPBACKGROUND: Background of help panels.
 * SYSCLR_HELPTEXT: Help text.
 * SYSCLR_HELPHILITE: Highlighted help text.
 * SYSCLR_SHADOWHILITEBGND: Shadows of workplace object background highlight color.
 * SYSCLR_SHADOWHILITEFGND: Shadows of workplace object foreground highlight color.
 * SYSCLR_SHADOWTEXT: Shadows of workplace object text color.


 * ulTablen (ULONG) - input:Number of elements.
 * Number of elements supplied in alTable. This may be 0 if, for example, the color table is merely to be reset to the default. For LCOLF_INDRGB it must be an even number.


 * alTable (PLONG) - input:Table.
 * Start address of the application data area, containing the color-table definition data. The format depends on the value of ulFormat.
 * Each color value is a 4-byte integer, with a value of R * 65536) + (G * 256) + B
 * where:
 * R is red intensity value
 * G is green intensity value
 * B is blue intensity value.
 * There are 8 bits for each primary; the maximum intensity for each primary is 255.

Return Code

 * rc (BOOL) - returns:Success indicator.
 * TRUE - Successful completion
 * FALSE - Error occurred.

Possible returns from WinGetLastError


 * PMERR_INVALID_HWND (0x1001):An invalid window handle was specified.
 * PMERR_INVALID_FLAG (0x1019):An invalid bit was set for a parameter. Use constants defined by PM for options, and do not set any reserved bits.
 * PMERR_PARAMETER_OUT_OF_RANGE (0x1003):The value of a parameter was not within the defined valid range for that parameter.

Calling Sequence

 * 1) define INCL_WINSYS /* Or use INCL_WIN, INCL_PM, */
 * 2) include 

HWND    hwndDeskTop;  /*  Desktop-window handle. */ ULONG   flOptions;    /*  Options. */ ULONG   ulFormat;     /*  Format of entries in the table, as follows. */ LONG    lStart;       /*  Starting system color index. */ ULONG   ulTablen;     /*  Number of elements. */ PLONG   alTable;      /*  Table. */ BOOL    rc;           /*  Success indicator. */

rc = WinSetSysColors(hwndDeskTop, flOptions,      ulFormat, lStart, ulTablen, alTable); 

Sample
This example changes the desktop background to blue and the output text to green. 
 * 1) define INCL_WINSYS
 * 2) define INCL_GPILOGCOLORTABLE
 * 3) include 

typedef struct { LONG index; LONG color; } ENTRY; LONG R, G ,B;

ENTRY alTable[2]; /* array of two color/index entries. */

R = 5L; G = 5L; B = 200L; alTable[0].color = (R * 65536L) + (G * 256L) + B; R = 5; G = 200; B = 5; alTable[1].color = (R * 65536L) + (G * 256L) + B; alTable[0].index = SYSCLR_OUTPUTTEXT; /* output text. */ alTable[1].index = SYSCLR_BACKGROUND; /* desktop background. */

WinSetSysColors (HWND_DESKTOP,               LCOL_RESET,     /* reset system colors before   */                                   /* processing remainder of this */                                   /* call.                        */                LCOLF_INDRGB,   /* Array of (index,RGB) */                                   /* values. Each pair of */                                   /* entries is 8 bytes   */                                   /* long, comprising 4   */                                   /* bytes for the index, */                                   /* and 4 bytes for the  */                                   /* color value. For     */                                   /* system color indexes,*/                                   /* see lStart.          */                0L,                /* not applicable.      */               (ULONG)4,               (PLONG)&alTable[0].index); 

Remarks
This function sends all main windows in the system a WM_SYSCOLORCHANGE message to indicate that the colors have changed. When this message is received, applications that depend on the system colors can query the new color values with the WinQuerySysColor function.

After the WM_SYSCOLORCHANGE messages are sent, all windows in the system are invalidated so that they are redrawn with the new system colors.

This function does not write any system color changes to the initialization file See

The following table gives the default RGB values for each color index:

Related Functions

 * WinQuerySysColor
 * WinSetSysColors

Related Messages

 * WM_SYSCOLORCHANGE