GetDCPenColor

[This is preliminary documentation and subject to change.]

The GetDCPenColor function sets the current device context (DC) pen color to the specified color value. GetDCPenColor will return the nearest physical color if the device cannot represent the specified color value.

GetDCPenColor(
  HDC hdc  // handle to the device context
);
 

Parameters

hdc
Handle the device context whose brush color is to be returned.

Return Values

If the function succeeds, the return value is a color reference for the previous DC pen color.

If the function fails, the return value is CLR_INVALID.

Remarks

The GetDCPenColor function will return the previous DC_PEN color even if the stock object DC_PEN is not selected in the DC. See Setting the Pen or Brush Color and SetDCPenColor for more information.

ICM: Color management is performed if ICM is enabled.

QuickInfo

  Windows NT: Requires version 5.0 or later.
  Windows: Requires Windows 98.
  Windows CE: Unsupported.
  Header: Declared in wingdi.h.
  Import Library: Included as a resource in msimg32.dll.

See Also

Device Contexts Overview, Device Context Functions