Partilhar via


CImageList::Attach

Call this function to attach an image list to a CImageList object.

BOOL Attach(
   HIMAGELIST hImageList 
);

Parameters

  • hImageList
    A handle to an image list object.

Return Value

Nonzero if the attachment was successful; otherwise 0.

Example

void AddQuestion(HIMAGELIST hmyImageList)
{
   CImageList imgList;

   // Attach the image list handle to the CImageList object.
   imgList.Attach(hmyImageList);

   // Add a new icon to the image list.
   imgList.Add(AfxGetApp()->LoadStandardIcon(IDI_QUESTION));

   // Detach the handle from the CImageList object.
   imgList.Detach();
}

Requirements

Header: afxcmn.h

See Also

Reference

CImageList Class

Hierarchy Chart

CImageList::Detach

CImageList::GetSafeHandle

Other Resources

CImageList Members