ImageList_AddMasked function

Adds an image or images to an image list, generating a mask from the specified bitmap.

Syntax


int ImageList_AddMasked(
   HIMAGELIST himl,
   HBITMAP    hbmImage,
   COLORREF   crMask
);

Parameters

himl

Type: HIMAGELIST

A handle to the image list.

hbmImage

Type: HBITMAP

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

crMask

Type: COLORREF

The color used to generate the mask. Each pixel of this color in the specified bitmap is changed to black, and the corresponding bit in the mask is set to 1.

Return value

Type: int

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

Remarks

The ImageList_AddMasked function copies the bitmap to an internal data structure. Bitmaps with color depth greater than 8bpp are not supported. Be sure to use the DeleteObject function to delete hbmImage after the function returns.

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: