Share via


CPen::operator HPEN

Gets the attached Windows GDI handle of the CPen object.

operator HPEN( ) const;

Return Value

If successful, a handle to the Windows GDI object represented by the CPen object; otherwise NULL.

Remarks

This operator is a casting operator, which supports direct use of an HPEN object.

For more information about using graphic objects, see the article Graphic Objects in Windows SDK.

Example

// Create a solid red pen of width 2.
CPen myPen(PS_SOLID, 2, RGB(255,0,0));

// Get the handle of the pen object.
HPEN hPen = (HPEN) myPen;   

Requirements

Header: afxwin.h

See Also

Reference

CPen Class

Hierarchy Chart