ImageList_ReplaceIcon function

Replaces an image with an icon or cursor.

Syntax


int ImageList_ReplaceIcon(
  _In_ HIMAGELIST himl,
  _In_ int        i,
  _In_ HICON      hicon
);

Parameters

himl [in]

Type: HIMAGELIST

A handle to the image list.

i [in]

Type: int

The index of the image to replace. If i is -1, the function appends the image to the end of the list.

hicon [in]

Type: HICON

The handle to the icon or cursor that contains the bitmap and mask for the new image.

Return value

Type: int

Returns the index of the image if successful, or -1 otherwise.

Remarks

Because the system does not save hicon, you can destroy it after the function returns if the icon or cursor was created by the CreateIcon function. You do not need to destroy hicon if it was loaded by the LoadIcon function; the system automatically frees an icon resource when it is no longer needed.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Commctrl.h

Library

Comctl32.lib

DLL

Comctl32.dll

 

 

Show: