Solved

developing a file explorer

Posted on 1998-01-28
5
311 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

763 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now