ImageList_Add function

Adds an image or images to an image list.

Syntax

int ImageList_Add(
  HIMAGELIST himl,
  HBITMAP    hbmImage,
  HBITMAP    hbmMask
);

Parameters

himl

Type: HIMAGELIST

A handle to the image list.

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.

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

   
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