SetSystemPaletteUse

Version 3.0

Syntax

WORD SetSystemPaletteUse(hDC,wUsage)

This function allows an application to use the full system palette. By default, the system palette contains 20 static colors which are not changed when an application realizes its logical palette.

The device context identified by the hDC parameter must refer to a device that supports color palettes.

Parameter Type/Description  

hDC HDC Identifies the device context.  
wUsage WORD Specifies the new use of the system palette. It can be either of these values:  
  Value Meaning
  SYSPAL_NOSTATIC System palette contains no static colors except black and white.
  SYSPAL_STATIC System palette contains static colors which will not change when an application realizes its logical palette.

Return Value

The return value specifies the previous usage of the system palette. It is either SYSPAL_NOSTATIC or SYSPAL_STATIC.

Comments

An application must call this function only when its window has input focus.

If an application calls SetSystemPaletteUse with wUsage set to SYSPAL_NOSTATIC, Windows continues to set aside two entries in the system palette for pure white and pure black, respectively.

After calling this function with wUsage set to SYSPAL_NOSTATIC, an application must follow these steps:

1.Call UnrealizeObject to force GDI to remap the logical palette completely when it is realized.

2.Realize the logical palette.

3.Call GetSysColors to save the current system-color settings.

4.Call SetSysColors to set the system colors to reasonable values using black and white. For example, adjacent or overlapping items (such as window frames and borders) should be set to black and white, respectively.

5.Broadcast the WM_SYSCOLORCHANGE message to allow other windows to be redrawn with the new system colors.

When the application's window loses focus or closes, the application must perform the following steps:

1.Call SetSystemPaletteUse with the wUsage parameter set to SYSPAL_STATIC.

2.Call UnrealizeObject to force GDI to remap the logical palette completely when it is realized.

3.Realize the logical palette.

4.Restore the system colors to their previous values.

5.Broadcast the WM_SYSCOLORCHANGE message.