The ImageList_AddMasked function adds an image or images to an image list, generating a mask from the specified bitmap.
int ImageList_AddMasked(
| HIMAGELIST himl, | // handle to the image list | 
| HBITMAP hbmImage, | // handle to the bitmap | 
| COLORREF crMask | // color used to generate mask | 
| ); | 
If the function succeeds, the return value is the index of the first new image.
If the function fails, the return value is - 1.
The ImageList_AddMasked function copies the bitmap to an internal data structure. Be sure to use the DeleteObject function to delete hbmImage and crMask after the function returns.