共用方式為


CBitmap::FromHandle

Returns a pointer to a CBitmap object when given a handle to a Windows GDI bitmap.

static CBitmap* PASCAL FromHandle(
   HBITMAP hBitmap 
);

Parameters

  • hBitmap
    Specifies a Windows GDI bitmap.

Return Value

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

Remarks

If a CBitmap object is not already attached to the handle, a temporary CBitmap object is created and attached. This temporary CBitmap object is valid only until the next time the application has idle time in its event loop, at which time all temporary graphic objects are deleted. Another way of saying this is that the temporary object is only valid during the processing of one window message.

Requirements

Header: afxwin.h

See Also

Reference

CBitmap Class

Hierarchy Chart

Other Resources

CBitmap Members