IImageList::ImageListSetIcon

[This is preliminary documentation and subject to change.]

Enables a user to set an icon in the image list or to create one if it is not there.

HRESULT ImageListSetIcon(
  long * pIcon,  // Win32 HICON handle of the icon
  long nLoc      // Specifies the assigned index
);
 

Parameters

pIcon
[in] Specifies the Win32 HICON handle of the icon to set. The type must be cast as a pointer to a long.
nLoc
[in] Specifies the index assigned to the entry. This is a virtual index that is internally mapped to the actual index.

Return Values

S_OK
The icon was successfully added or replaced.
E_INVALIDARG
The pIcon parameter is NULL or the nloc parameter is negative.
E_UNEXPECTED
An unexpected error occurred.

Remarks

If the index specified by nLoc has been used before, ImageListSetIcon replaces the icon stored at nLoc. If it has not been previously used, a new entry in the image list will be added. The icon being inserted must have both the 32x32 and 16x16 pixel sizes defined.

See Also

IImageList