ImageList_Replace function (commctrl.h)

Replaces an image in an image list with a new image.

Syntax

BOOL ImageList_Replace(
  HIMAGELIST himl,
  int        i,
  HBITMAP    hbmImage,
  HBITMAP    hbmMask
);

Parameters

himl

Type: HIMAGELIST

A handle to the image list.

i

Type: int

An index of the image to replace.

hbmImage

Type: HBITMAP

A handle to the bitmap that contains the image.

hbmMask

Type: HBITMAP

A handle to the bitmap that contains the mask. If no mask is used with the image list, this parameter is ignored.

Return value

Type: BOOL

Returns nonzero if successful, or zero otherwise.

Remarks

The ImageList_Replace function copies the bitmap to an internal data structure. Be sure to use the DeleteObject function to delete hbmImage and hbmMask after the function returns.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header commctrl.h
Library Comctl32.lib
DLL Comctl32.dll