extract icon from .exe

Posted on 1999-11-07
Medium Priority
Last Modified: 2013-12-03

I want to extract a .exe's icon and add to my listview.
The problem is:
I can use SHGetFileInfo() to get the system-wide registered icon in the registry,but I can not get the icon of those .exe which are not registerd.

BUt I find exploer can do this.HOw to?
Question by:geeboy
  • 3
LVL 15

Accepted Solution

NickRepin earned 100 total points
ID: 2189327
// Load exe or dll

Now you can use, say,


to enumerate all icons.
LVL 15

Expert Comment

ID: 2189328
You get icon names while enumeration. Use LoadIcon(h,iconName) to load icon itself.

Author Comment

ID: 2189479
First ,thank you very  much for answering me two questions!
Does explorer use this way?

I sole goal is to show some .exe into my listview and add it's icon beside the name.So,as you said,I need loadlibray for every .exe?

And I don't know which icon I need,I only want to show the icon of the .exe which the Explorer show.

So,I only need one icon to show.For example,if I write a .exe and when I view it in the Explorer,there is an icon beside the name of my .exe,how to extract that icon?

LVL 23

Expert Comment

ID: 2189839
Use ExtractIcon or ExtractIconEx.
LVL 15

Expert Comment

ID: 2190008
>>Does explorer use this way ?

Nobody knows this except Microsoft. Most likely, it uses ExtractIcon().

>>I need loadlibray for every .exe?

chensu's suggestion is more easy to implement.

You can use just

HICON hIcon=ExtractIcon(hYourAppInstance,fileName,0);

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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 video I will demonstrate how to set up Nine, which I now consider the best alternative email app to Touchdown.
Suggested Courses

601 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