ImageList_Add function (commctrl.h)

Adds an image or images to an image list.

Syntax

int ImageList_Add(
  [in]           HIMAGELIST himl,
  [in]           HBITMAP    hbmImage,
  [in, optional] HBITMAP    hbmMask
);

Parameters

[in] himl

Type: HIMAGELIST

A handle to the image list.

[in] hbmImage

Type: HBITMAP

A handle to the bitmap that contains the image or images. The number of images is inferred from the width of the bitmap.

[in, optional] 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. This parameter can be NULL.

Return value

Type: int

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

Remarks

The ImageList_Add 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