SetSystemPaletteUse

3.0

  UINT SetSystemPaletteUse(hdc, fuStatic)    
  HDC hdc; /* handle of device context */
  UINT fuStatic; /* system-palette contents, */  

The SetSystemPaletteUse function sets the use of static colors in the system palette. The default system palette contains 20 static colors, which are not changed when an application realizes its logical palette. An application can use SetSystemPaletteUse to change this to two static colors (black and white).

Parameters

hdc

Identifies the device context. This device context must support color palettes.

fuStatic

Specifies the new use of the system palette. This parameter can be either of the following values:

Value Meaning

SYSPAL_NOSTATIC System palette contains no static colors except black and white.
SYSPAL_STATIC System palette contains static colors that will not change when an application realizes its logical palette.

Return Value

The return value is the previous setting for the static colors in the system palette, if the function is successful. This setting is either SYSPAL_NOSTATIC or SYSPAL_STATIC.

Comments

An application must call this function only when its window is maximized and has the input focus.

If an application calls SetSystemPaletteUse with fuStatic 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 fuStatic set to SYSPAL_NOSTATIC, an application must follow these steps:

1.Call the UnrealizeObject function to force the graphics device interface (GDI) to remap the logical palette completely when it is realized.

2.Realize the logical palette.

3.Call the GetSysColor function to save the current system-color settings.

4.Call the SetSysColors function 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.Send the WM_SYSCOLORCHANGE message to other top-level windows to allow them 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 fuStatic 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.Send the WM_SYSCOLORCHANGE message.

See Also

GetSysColor, SetSysColors, SetSystemPaletteUse, UnrealizeObject