Overview
Group
Quick Info

Windows NT
Yes
Win95
Yes
Win32s
Yes
Import Library
gdi32.lib
Header File
wingdi.h
Unicode
No
Platform Notes
Windows 95: int == 16 bits

GetNearestPaletteIndex

The GetNearestPaletteIndex function retrieves the index for the entry in the specified logical palette most closely matching a specified color value.

UINT GetNearestPaletteIndex(

HPALETTE hpal,
// handle of logical color palette
COLORREF crColor
// color to be matched
);

Parameters

hpal

Identifies a logical color palette.

crColor

Specifies a color to be matched.

Return Values

If the function succeeds, the return value is the index of an entry in a logical palette.

If the function fails, the return value is CLR_INVALID. 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.

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

See Also

GetDeviceCaps
, GetNearestColor, GetPaletteEntries, GetSystemPaletteEntries, COLORREF

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples