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.)
UINT SetSystemPaletteUse(
HDC hdc, |
// handle of device context |
UINT uUsage |
// palette-usage flag |
); |
Value |
Meaning |
SYSPAL_NOSTATIC |
The system palette contains two static colors (black and white). |
SYSPAL_STATIC |
The system palette contains static colors that will not change when an application realizes its logical palette. |
If the function succeeds, the return value is the previous usage of the system palette (it can be either SYSPAL_NOSTATIC or SYSPAL_STATIC).
If the function fails, the return value is SYSPAL_ERROR. To get extended error information, call GetLastError.
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, Windows 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:
When the application’s window loses focus or closes, the application must perform the following steps:
GetDeviceCaps, GetSysColor, SetSysColors, GetSystemPaletteUse
See: