SetSystemPaletteUse function (wingdi.h)
The SetSystemPaletteUse function allows an application to specify whether the system palette contains 2 or 20 static colors. The default system palette contains 20 static colors. (Static colors cannot be changed when an application realizes a logical palette.)
Syntax
UINT SetSystemPaletteUse(
[in] HDC hdc,
[in] UINT use
);
Parameters
[in] hdc
A handle to the device context. This device context must refer to a device that supports color palettes.
[in] use
The new use of the system palette. This parameter can be one of the following values.
Return value
If the function succeeds, the return value is the previous system palette. It can be either SYSPAL_NOSTATIC, SYSPAL_NOSTATIC256, or SYSPAL_STATIC.
If the function fails, the return value is SYSPAL_ERROR.
Remarks
An application can determine whether a device supports palette operations by calling the GetDeviceCaps function and specifying the RASTERCAPS constant.
When an application window moves to the foreground and the SYSPAL_NOSTATIC value is set, the application must call the GetSysColor function to save the current system colors setting. It must also call SetSysColors to set reasonable values using only black and white. When the application returns to the background or terminates, the previous system colors must be restored.
If the function returns SYSPAL_ERROR, the specified device context is invalid or does not support color palettes.
An application must call this function only when its window is maximized and has the input focus.
If an application calls SetSystemPaletteUse with uUsage set to SYSPAL_NOSTATIC, the system continues to set aside two entries in the system palette for pure white and pure black, respectively.
After calling this function with uUsage set to SYSPAL_NOSTATIC, an application must take the following steps:
- Realize the logical palette.
- Call the GetSysColor function to save the current system-color settings.
- 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.
- Send the WM_SYSCOLORCHANGE message to other top-level windows to allow them to be redrawn with the new system colors.
- Call SetSystemPaletteUse with the uUsage parameter set to SYSPAL_STATIC.
- Realize the logical palette.
- Restore the system colors to their previous values.
- Send the WM_SYSCOLORCHANGE message.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | wingdi.h (include Windows.h) |
Library | Gdi32.lib |
DLL | Gdi32.dll |