Click here to Skip to main content
15,746,918 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

Can anyone give me an example of how to combine 2 CImageList into another CImageList resulting in a CImageList that contains all of the images?

One CImageList contains system shell icons and another contains images loaded locally from the application. Ultimately, I need to fill a CTreeCtrl with a mixture of images from both lists.

Any help would be appreciated.


What I have tried:

I've tried using the Create function that takes two image lists as parameters but that just overlays the images on each other it doesn't 'add' them together.
Updated 14-Apr-20 11:15am
KarstenK 14-Apr-20 5:55am    
Did you ask Google for it? :-O

Use the CImageList Class | Microsoft Docs[^] Add() method to combine the lists.
Share this answer
Maciej Los 14-Apr-20 5:40am    
Hi Thanks for the suggestion.

I actually found that article in my quest. Problem is the system image list has 174 or so icons and looping that code to get each image as a bitmap doesn't sound like the best idea - Although I may need to end up doing it that way.

Thank You!
Share this answer
Thanks for responding but as far as I can tell the Add member doesn't add ImageLists, it adds bitmaps and Icons...

<pre>int Add(
    CBitmap* pbmImage,
    CBitmap* pbmMask);

int Add(
    CBitmap* pbmImage,
    COLORREF crMask);

int Add(HICON hIcon);

It would work if I can extract the bitmap from the CImageList.

Thanks again!
Share this answer
jeron1 14-Apr-20 16:17pm    

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900