Solved

developing a file explorer

Posted on 1998-01-28
5
319 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 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

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 extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

728 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