Partager via


CImageList::FromHandle

Returns a pointer to a CImageList object when given a handle to an image list.

static CImageList* PASCAL FromHandle(
   HIMAGELIST hImageList 
);

Parameters

  • hImageList
    Specifies the image list.

Return Value

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

Remarks

If a CImageList is not already attached to the handle, a temporary CImageList object is created and attached. This temporary CImageList object is valid only until the next time the application has idle time in its event loop, at which time all temporary objects are deleted.

Example

CImageList* ConvertHandle(HIMAGELIST hmyImageList)
{
   // Convert the HIMAGELIST to a CImageList*.
   ASSERT(hmyImageList != NULL);
   CImageList* pmyImageList = CImageList::FromHandle(hmyImageList);
   ASSERT(pmyImageList != NULL);

   return pmyImageList;
}

Requirements

Header: afxcmn.h

See Also

Concepts

CImageList Class

CImageList Members

Hierarchy Chart

CImageList::FromHandlePermanent