Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function adds an image or images to an image list.

Syntax

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

Parameters

himl

[in] Handle to the image list.

hbmImage

[in] Handle to the bitmap that contains the image or images. The number of images is inferred from the width of the bitmap.

hbmImagecan be a handle to either a device-independent bitmap (DIB) or a device-dependent bitmap (DDB) bitmap.

hbmMask

[in] Handle to the bitmap that contains the mask. If no mask is used with the image list, this parameter is ignored.

Return Value

The index of the first new image indicates success. –1 indicates failure.

Remarks

The ImageList_Addfunction copies the bitmap to an internal data structure. Be sure to use the DeleteObjectfunction to delete hbmImageand hbmMaskafter the function returns.

Support for DIBs is available only in Windows CE 5.0 and later..

Requirements

Header commctrl.h
Library commctrl.lib, Imgctl.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also