ResizePalette function (wingdi.h)

The ResizePalette function increases or decreases the size of a logical palette based on the specified value.


BOOL ResizePalette(
  [in] HPALETTE hpal,
  [in] UINT     n


[in] hpal

A handle to the palette to be changed.

[in] n

The number of entries in the palette after it has been resized.

The number of entries is limited to 1024.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.


An application can determine whether a device supports palette operations by calling the GetDeviceCaps function and specifying the RASTERCAPS constant.

If an application calls ResizePalette to reduce the size of the palette, the entries remaining in the resized palette are unchanged. If the application calls ResizePalette to enlarge the palette, the additional palette entries are set to black (the red, green, and blue values are all 0) and their flags are set to zero.


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

See also

Color Functions

Colors Overview