GetNearestColor

This function returns the system palette color that will be displayed when the specified color value is used.

COLORREF GetNearestColor(
HDC hdc, 
COLORREF crColor
); 

Parameters

  • hdc
    [in] Handle to the device context (DC).
  • crColor
    [in] Specifies a color value that identifies a requested color.

Return Values

If the function succeeds, the return value identifies a color from the system palette that corresponds to the specified color value.

If the function fails, the return value is CLR_INVALID.

To get extended error information, call GetLastError.

Remarks

The GetNearestColor function returns the color from the selected device context that most closely matches the specified color value.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Wingdi.h   Mgpal.lib

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

GetDeviceCaps, GetLastError, COLORREF

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.