GetPixel

This function retrieves the red, green, blue (RGB) color value of the pixel at the specified coordinates.

At a Glance

Header file: Wingdi.h
Windows CE versions: 1.0 and later

Syntax

COLORREF GetPixel(HDC hdc, int nXPos, int nYPos);

Parameters

hdc

[in] Handle to the device context.

nXPos

[in] Specifies the logical x-coordinate of the pixel to be examined.

nYPos

[in] Specifies the logical y-coordinate of the pixel to be examined.

Return Values

The RGB value of the pixel indicates success. CLR_INVALID indicates that the pixel is outside of the current clipping region.

Remarks

The pixel must be within the boundaries of the current clipping region.

Not all devices support GetPixel. An application should call GetDeviceCaps to determine whether a specified device supports this function.

See Also

GetDeviceCaps, SetPixel