Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Call this function to create an icon based on an image and its related mask in an image list.
HICON ExtractIcon(
int nImage
);
Parameters
- nImage
Zero-based index of the image.
Return Value
Handle of the icon if successful; otherwise NULL.
Remarks
This method relies on the behavior of the ImageList_ExtractIcon macro to create the icon. Refer to the ImageList_ExtractIcon macro for more information on icon creation and cleanup.
Example
int i, dx, cx, cy, nCount = m_myImageList.GetImageCount();
HICON hIcon;
::ImageList_GetIconSize(m_myImageList, &cx, &cy);
// Draw the images of the image list on the DC.
for (dx = 0, i = 0; i < nCount; i++)
{
hIcon = m_myImageList.ExtractIcon(i);
dc.DrawIcon(dx, 0, hIcon);
dx += cx;
}
Requirements
Header: afxcmn.h