ImageList_SetImageCount should set nCurImage (the number of
images in the list) to the value specified, and expect that
ImageList_ReplaceImage is called to set the new images.
diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index 5097488..0938548 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -968,8 +968,12 @@
else
himl->hbmImage = 0;
- if ( (himl->cMaxImage > 0) && (himl->flags & ILC_MASK)) {
- himl->hbmMask = CreateBitmap (himl->cx * himl->cMaxImage, himl->cy,
+ if ( (himl->flags & ILC_MASK)) {
+ int images = himl->cMaxImage;
+ if (images <= 0)
+ images = 1;
+
+ himl->hbmMask = CreateBitmap (himl->cx * images, himl->cy,
1, 1, NULL);
if (himl->hbmMask == 0) {
ERR("Error creating mask bitmap!\n");
@@ -1409,6 +1413,10 @@
/*
Draw the image
*/
+
+ TRACE("hbmMask(0x%08x) iImage(%d) x(%d) y(%d) cx(%d) cy(%d)\n",
+ pimldp->himl->hbmMask, pimldp->i, pimldp->x, pimldp->y, cx, cy);
+
if(pimldp->himl->hbmMask != 0)
{
IMAGELIST_InternalDrawMask(pimldp, cx, cy);
@@ -2428,6 +2436,8 @@
HDC hdcImageList, hdcImage;
BITMAP bmp;
+ TRACE("%p %d %04x %04x\n", himl, i, hbmImage, hbmMask);
+
if (himl == NULL) {
ERR("Invalid image list handle!\n");
return FALSE;
@@ -2796,12 +2806,17 @@
HBITMAP hbmNewBitmap;
INT nNewCount, nCopyCount;
+ TRACE("%p %d\n",himl,iImageCount);
+
if (!himl)
return FALSE;
if (himl->cCurImage >= iImageCount)
return FALSE;
if (himl->cMaxImage > iImageCount)
+ {
+ himl->cCurImage = iImageCount;
return TRUE;
+ }
nNewCount = iImageCount + himl->cGrow;
nCopyCount = min(himl->cCurImage, iImageCount);
@@ -2863,8 +2878,7 @@
/* Update max image count and current image count */
himl->cMaxImage = nNewCount;
- if (himl->cCurImage > nCopyCount)
- himl->cCurImage = nCopyCount;
+ himl->cCurImage = iImageCount;
return TRUE;
}