Solved

developing a file explorer

Posted on 1998-01-28
5
316 Views
Last Modified: 2013-12-03
While developing an file explorer I have problems extracting the smallicon of the associated executable file.

The large on wasn't difficult: You only have to use the api call EXTRACTASSOCIATEDICON and you will get an iconhandle. The system metrics define the size of the returned icon. This ist 32x32 with normal screen resolution.

Thanks

Marc
0
Comment
Question by:M_Hoeper
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:galkin
ID: 1410525
You cannot do this with ExtratAssociatedIcon. You must use LoadImage instaed specifying LR_LOADFROMFILE, IMAGE_ICON
 and cxDesired and cxDesired as 16.
0
 

Author Comment

by:M_Hoeper
ID: 1410526
I can get the icon index in the associated executable from the EXTRACTASSOCIATEDICON (doesn't work??) or from the registry.

But I hadn't success using LoadImage with this information. I didn't find any routine of the Windows nt api which allows me to use the icon index found in the registry.
0
 
LVL 7

Accepted Solution

by:
galkin earned 150 total points
ID: 1410527
ExtratAssociatedIcon allows you to extract only default icon. To extract icon you want use ExtractIconEx, this function allows you to extract both small and large icons of any icon index. what ExtratAssociatedIcon does is it looks up in registry according to the file extension, finds default icon index and target icon file and then loads icon. The problem is it loads icon of default size. If you want to load both small and large icon you must do the following. First extract file etension. Say you have file document.doc file extension is ".doc" Look into registry under HKEY_CLASSES_ROOT\.doc. Read this key default value. On my computer it is "Word.Document.6". Now look the key HKEY_CLASSES_ROOT\Word.Document.6. It has subkey "DefaultIcon" which default value is full path to the file containing the icon foolowed by icon idex separated by comma. You can read this infornation and knowing file and icon index extract both large and small icon with ExtractIconEx.
0
 

Author Comment

by:M_Hoeper
ID: 1410528
Thank you! My help system kept back this information. I wrote a small sample and it works very good.

But: Why doesn't EXTRACTASSOCIATEDICON return the associated exe file and its index?

In another expert area they recommend to use SHGetFileInfo. My help system remarks, that this routine only runs on Windows 95 os. I tried and learned that it works with win nt 4, too...?

Do you send me the help for the ExtractIconEx routine? E.g. what is the meaning of the last parameter?

Thanks a lot

Marc (m.hoeper@tu-bs.de)
0
 

Author Comment

by:M_Hoeper
ID: 1410529
Thank you! My help system kept back this information. I wrote a small sample and it works very good.

But: Why doesn't EXTRACTASSOCIATEDICON return the associated exe file and its index?

In another expert area they recommend to use SHGetFileInfo. My help system remarks, that this routine only runs on Windows 95 os. I tried and learned that it works with win nt 4, too...?

Do you send me the help for the ExtractIconEx routine? E.g. what is the meaning of the last parameter?

Thanks a lot

Marc (m.hoeper@tu-bs.de)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question