dynamic CImageList icons - possible? [modified]
-
I have a CTreeCtrl and an associated CImageList. Is there any way I can load images into the CImageList at runtime (e.g. from an .ico file supplied by the user) without them being hardcoded into the executable files ? -- modified at 14:21 Thursday 4th January, 2007
cheers, Neil
-
I have a CTreeCtrl and an associated CImageList. Is there any way I can load images into the CImageList at runtime (e.g. from an .ico file supplied by the user) without them being hardcoded into the executable files ? -- modified at 14:21 Thursday 4th January, 2007
cheers, Neil
You can add/remove images from image lists dynamically. Check out CImageList::Add() (::ImageList_AddIcon()), ::LoadImage(), etc. Mark
-
I have a CTreeCtrl and an associated CImageList. Is there any way I can load images into the CImageList at runtime (e.g. from an .ico file supplied by the user) without them being hardcoded into the executable files ? -- modified at 14:21 Thursday 4th January, 2007
cheers, Neil
Yes - although if dealing with a lot of images it is better to initially size the ImageList control to hold a bunch of images. The
CImageList::GetImageInfo(...)
function or theImageList_GetImageInfo(...)
macro can be used to write data into the images maintained by the ImageList control. Peace!-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles -
I have a CTreeCtrl and an associated CImageList. Is there any way I can load images into the CImageList at runtime (e.g. from an .ico file supplied by the user) without them being hardcoded into the executable files ? -- modified at 14:21 Thursday 4th January, 2007
cheers, Neil
-
I have a CTreeCtrl and an associated CImageList. Is there any way I can load images into the CImageList at runtime (e.g. from an .ico file supplied by the user) without them being hardcoded into the executable files ? -- modified at 14:21 Thursday 4th January, 2007
cheers, Neil
Yes you have many good function in
CImageList
Add,Remove,Replace
WhiteSky
-
Yes you have many good function in
CImageList
Add,Remove,Replace
WhiteSky
Thanks to everyone for the posts. I know these functions, but they don't realy explain how to load icons from files or "external" data sources - this is what I meant by dynamic (the icons aren't already hardcoded as resources in the executables). I found the functions I was looking for, which are: ExtractIcon() - load icon from disk CreateIconFromResourceEx() - load icon from memory Sorry, I think I should have explained what I was after a bit better..
cheers, Neil
-
Thanks to everyone for the posts. I know these functions, but they don't realy explain how to load icons from files or "external" data sources - this is what I meant by dynamic (the icons aren't already hardcoded as resources in the executables). I found the functions I was looking for, which are: ExtractIcon() - load icon from disk CreateIconFromResourceEx() - load icon from memory Sorry, I think I should have explained what I was after a bit better..
cheers, Neil
I think you need to
SHGetFileInfo
to get information about file and... and also if you dont know about CImageList and its functions search on the codeproject it has a lot of good articles :)
WhiteSky