GetSystemPaletteEntries

The GetSystemPaletteEntries function retrieves a range of palette entries from the system palette that is associated with the specified device context.

UINT GetSystemPaletteEntries(
  HDC hdc,              // handle of device context
  UINT iStartIndex,     // index of first entry to be retrieved
  UINT nEntries,        // number of entries to be retrieved
  LPPALETTEENTRY lppe   // array receiving system-palette entries
);
 

Parameters

hdc
Handle to the device context.
iStartIndex
Specifies the first entry to be retrieved from the system palette.
nEntries
Specifies the number of entries to be retrieved from the system palette.
lppe
Pointer to an array of PALETTEENTRY structures to receive the palette entries. The array must contain at least as many structures as specified by the nEntries parameter. If this parameter is NULL, the function returns the total number of entries in the palette.

Return Values

If the function succeeds, the return value is the number of entries retrieved from the palette.

If the function fails, the return value is zero.

Windows NT: To get extended error information, call GetLastError.

Remarks

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

Windows CE: The GetSystemPaletteEntries function will fail if the device associated with hdc does not have a settable palette. Use GetDeviceCaps to determine if the device has a settable palette before using GetSystemPaletteEntries.

QuickInfo

  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Requires version 2.0 or later.
  Header: Declared in wingdi.h.
  Import Library: Use gdi32.lib.

See Also

Colors Overview, Color Functions, GetDeviceCaps, GetPaletteEntries, PALETTEENTRY