Share via


CBrush::FromHandle

Returns a pointer to a CBrush object when given a handle to a Windows HBRUSH object.

static CBrush* PASCAL FromHandle( 
   HBRUSH hBrush  
);

Parameters

  • hBrush
    HANDLE to a Windows GDI brush.

Return Value

A pointer to a CBrush object if successful; otherwise NULL.

Remarks

If a CBrush object is not already attached to the handle, a temporary CBrush object is created and attached. This temporary CBrush object is valid only until the next time the application has idle time in its event loop. At this time, all temporary graphic objects are deleted. In other words, the temporary object is valid only during the processing of one window message.

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

Example

See the example for CBrush::CBrush.

Requirements

Header: afxwin.h

See Also

Reference

CBrush Class

Hierarchy Chart