GetNearestPaletteIndex

  UINT GetNearestPaletteIndex(hpal, crColor)    
  HPALETTE hpal; /* handle of logical color-palette */
  COLORREF crColor; /* color to be matched */

The GetNearestPaletteIndex function retrieves the index for the entry in the given logical palette that most closely matches a given color value.

Parameters

hpal

Identifies a logical palette.

crColor

Specifies a color to be matched.

Return Value

The return value is the index of an entry in a logical palette if the function is successful. Otherwise it is CLR_INVALID.

Comments

If the given logical palette contains entries with the PC_EXPLICIT flag set, the return value is undefined.

See Also

COLORREF