News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Displaying icons in a listview.

Started by Custos, May 21, 2011, 10:34:13 AM

Previous topic - Next topic

Gunner

How are you getting the system image list?  How are you calling SHGetFileInfo?  You explain a problem but no sample source?


use SHGFI_USEFILEATTRIBUTES so SHGetFileInfo does not "access" the file so it will be faster
invoke  SHGetFileInfo, PATHTOFILETOGETICONFOR, NULL, addr sfi, sizeof sfi,  SHGFI_SYSICONINDEX or SHGFI_USEFILEATTRIBUTES or SHGFI_LARGEICON or SHGFI_ICON
~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

Custos

I am getting the system image list like this:

invoke SHGetFileInfo, NULL, 0, addr sfi, sizeof SHFILEINFO, SHGFI_SYSICONINDEX or SHGFI_SMALLICON
mov hImageListSmall, eax

After that I set the imagelist for the listview:
invoke SendMessage, hListview, LVM_SETIMAGELIST, LVSIL_SMALL, hImageListSmall

and have been calling SHGetFileInfo like this:

invoke SHGetFileInfo, addr filename, NULL,addr sfi,SIZEOF SHFILEINFO,SHGFI_SYSICONINDEX

I tried your suggestion but it did not make any noticeable improvement in speed.  Also, it only displays default program icons for executable files and I want display the actual program icons.

I did not post any sample source because I do not have a problem with my code.  The problem is that I am looking for a faster way to display the icons.

Thanks for your suggestion.

jj2007

Quote from: Custos on May 22, 2011, 04:05:16 AM
The problem is that I am looking for a faster way to display the icons.

Don't ask for impossible things. Either your code, or the system, has to extract the icons from all executables. That is a lot of work for the hard disk.

The only way to speed this up is to carefully select the number of executables to those that are really being displayed - i.e. those 20-30 that actually show up in your listview.

dedndave

.... or, it may be that Windows Explorer has cached them someplace   :P

C:\Documents and Settings\Dave\Local Settings\Application Data\IconCache.db

Tedd

1. Do as I originally said
2. Treat .exes specially and extract their icons individually
3. Use I_IMAGECALLBACK for the image index when you add new items, and handle LVN_GETDISPINFO to find and set the real icon when requested (which is only when they're drawn)
3b. Add LVIF_DI_SETITEM to the mask when responding to LVN_GETDISPINFO, so you don't extract the same icons repeatedly.
No snowflake in an avalanche feels responsible.