Export (0) Print
Expand All
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.


Windows Mobile 6.5
A version of this page is also available for

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

COLORREF GetNearestColor(
  HDC hdc, 
  COLORREF crColor


[in] Handle to the device context (DC).


[in] Specifies a color value that identifies a requested color.

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.

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

Windows Embedded CEWindows CE 1.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

© 2014 Microsoft