I have an explorer like application in which I have to populate the list control. I am using system list for the list control. But the icons for the machines under Network Neighborhood takes a long long time. So I thought of hardcoding the image number which is 5 so that it does not have to look for the image number in the list. But this doesn't seem to work. It displays blank space instead of the icon.
I tried to do a simple Explorer and I use a CListCtrl. Image list was taken from image system list using SHGetFileInfo function (of course passing name of file ).
Previously the system list image was shared with list control.
But for a folder with up to 2000 files ( KitNT40 - precisely) getting image index and fill list is terrible slow ( 9-10 sec.). I wrote a little profiler using QueryPerformanceCounter() function and most time is spend in SHGetFileInfo() function for getting icon index.
I look at ACDSEE32 application and there the some thing is perfectfully O.K. - it takes 1 sec and interesting, I don't belive that use a separate thread.( Maybe I'm wrong ...)
What trick I can use?
Plese help me if you can. Thanks a lot for your time !
( And excuse my bad english ...)
The main reason why it probably didn't work before was that you were putting the SystemImageList in a HIMAGELIST, instead of doing that you can directly attach it and detach it to a CImageList control without going through the use of a HIMAGELIST. It's not like you can detach the HIMAGELIST from the system image list. Well,.. there probably is a way, but takes to much time. :)
I think this is what I have in the alternative example posted on here.
The trick here appears to be quite simple. Just add the LVS_SHAREIMAGELISTS flag to the list view style, or mark the "Share Image List" check box in the resource editor.
Doing so tells the list control it does not own the image list, and therefore should not destroy it.
This method works with either the Attach()-Detach() or the FromHandle() approaches.
I am using a application genrated met the appwizzard from vc6.0 and my assumptions are that the Inialisation should be in the create method (see code fragment) and the release should be in the ondestroy from the listview class..
but whatever i try to do after my application quits, all my system icons disapear, here in this codesample i am using the fromhandle, but whith attach the problem is exact the same,