but the docs say GetImageInfo returns an ImageInfo structure, which
includes an hBitmap.
Indeed it does. Having the bitmap(s) is where my problems started. :-\
Indeed it does. Having the bitmap(s) is where my problems started. :-\
I'm confused.
The ImageList is giving you the *handle* of the
bitmap that it is using. So whatever you do using that bitmap
handle as the target of some drawing operation will update the
bitmap that is being used by the ImageList.
Are you not seeing the changes in the ImageList?
you'll need to redraw whatever control is using the ImageList
to see the effect on screen, e.g. call InvalidateRect.
The ImageList is giving you the *handle* of the
bitmap that it is using. So whatever you do using that bitmap
handle as the target of some drawing operation will update the
bitmap that is being used by the ImageList.
To be able to alter a HBITMAP you need to select it into a "device context" >(DC). described in the docs you can only do that into one at a time (1).
And as an imagelist has already selected the bitmap(s) into its own DC (2) >...
I see that on ComCtl32.dll version 6 or later, they have a way
for you to QueryInterface for an IImageList interface which has
a Replace method that you can use to replace the bitmap.
Richard,
I see that on ComCtl32.dll version 6 or later, they have a way
for you to QueryInterface for an IImageList interface which has
a Replace method that you can use to replace the bitmap.
The "IImageList::Replace" method you mean (or the function >"ImageList_Replace") ?
Yes, you can replace the image *of a single item*
with that. Which is rather useless when you have a big bitmap (from >"ImageList_GetImageInfo"), with all items on it.
But you've skipped the most important part of the problem: How do I edit
that big bitmap ?
The "IImageList::Replace" method you mean (or the function >>"ImageList_Replace") ?
I didn't notice the function until you mentioned it, but they seem
to be the same.
Have you tried the function? It seems to do what you want.
Without decompiling, we don't know what the implementation does,
but if I were to implement it, I would take the given bitmap and use
that as a source for a copy operation into the internal bitmap used
by the image list.
In fact, the Add function documentation explicitly mentions that
the supplied bitmap is copied into an "internal data structure".
Again, without decompiling, we can't infer what happens behind the
scenes.
At best, we should only be going by what is documented behavior,
and it seems that ImageList_Replace is the function provided
to do what you want.
Again, have you tried that and does it give the desired visual
results?
If yes, what exactly is the problem?
But you've skipped the most important part of the problem: How do I
edit that big bitmap ?
I don't think you can edit it directly;
you are intended to use the ImageList functions to replace images as a
whole.
The bitmap handle in the IMAGEINFO struct could be use as the source
for a bitmap copy,
but as you (and the documentation points out) the bitmap is selected
into a DC and there's no way to obtain that internal DC.
I'm away from my copy of Rector & Newcomer, so I don't have anything
besides the MS docs to go on.
It's entirely possible that this "manipulate the bitmap directly"
language is a holdover from Win16 and isn't relevant to Win32.
you are intended to use the ImageList functions to replace images
as a whole.
Nope.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 379 |
Nodes: | 16 (2 / 14) |
Uptime: | 42:37:14 |
Calls: | 8,141 |
Calls today: | 4 |
Files: | 13,085 |
Messages: | 5,857,851 |