?
Solved

developing a file explorer

Posted on 1998-01-28
5
Medium Priority
?
321 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 600 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

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 surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

764 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