CImageList::ExtractIcon

HICON ExtractIcon( int nImage );

Return Value

Handle of the icon if successful; otherwise NULL.

Parameters

nImage

Zero-based index of the image.

Remarks

Call this function to create an icon based on an image and its related mask in an image list.

Example

// The pointer to my image list.
extern CImageList* pmyImageList;
extern CDC* pmyDC;

int   i, dx, cx, cy, nCount = pmyImageList->GetImageCount();
HICON hIcon;

::ImageList_GetIconSize(*pmyImageList, &cx, &cy);

// Draw the images of the image list on the DC.
for (dx=0,i=0;i < nCount;i++)
{
   hIcon = pmyImageList->ExtractIcon(i);

   pmyDC->DrawIcon(dx, 0, hIcon);
   dx += cx;
}

CImageList OverviewClass MembersHierarchy Chart

See Also   CImageList::Replace