views:

73

answers:

1

If I have a Vista .ico file which contains a 16x16, 32x32, 256x256 etc. version of an icon, I can successfully load it as a .NET Icon by simply doing -:

Icon myIcon = new Icon("C:\\MyIcon.ico");

I can then access all of the various sized images in the icon. I can even access the 256x256 Vista PNG using methods detailed HERE.

However, I haven't found a way to get the full set of icon images from a Vista executable. Unfortunately, doing this -:

Icon myIcon = Icon.ExtractAssociatedIcon("C:\\MyExe.exe");

...only results in a single 32x32 image being extracted. Is there a way get the entire set of images from an executable as a .NET Icon? Preferably one that also works in XP.

A: 

Have a look at this article 'IconLib' on CodeProject. Also, look at this version using the 'ExtractIconExA' API via pinvoke in VB.NET.

Hope this helps, Best regards, Tom.

tommieb75
As much as I respect IconLib, it's a colossus of undocumented and unsafe code. All I need is something that can locate the icon in a PE and read the png portion into a stream. ExtractIconExA is a .Net 1.1 project that knows nothing about Vista icons.
Damien
That's the problem...unfortunately the Win 7's storage of icon as a png has changed the landscape in terms of storage as a embedded resource in the binary image ie png...here's another link...http://www.codeproject.com/KB/cs/IconExtractor.aspx. IconLib is admittedly too big...but what can you do...
tommieb75