Windows Develop Bookmark and Share   
 index > Windows Forms General > How To Extract Icons From Exe Or Dll Files Using ExtractAssociatedIcon ??
 

How To Extract Icons From Exe Or Dll Files Using ExtractAssociatedIcon ??

Hello ..

I Use ExtractAssociatedIcon To Extract Icons from exe files ..

but i want to know how to use it to extrcat the second and thered and forth and fifth icon from exe or dll icon ..

because this method is extracting the first icon ..

i use it like this ..

Me.Icon = System.Drawing.Icon.ExtractAssociatedIcon("C:\Windows\Explorer.exe")

I Tried To Use it like this but it didn't work :

Me.Icon = System.Drawing.Icon.ExtractAssociatedIcon("C:\Windows\Explorer.exe 5")

Me.Icon = System.Drawing.Icon.ExtractAssociatedIcon("C:\Windows\Explorer.exe, -5")

Thanks , with best regards ..

mohdtmn  Wednesday, August 23, 2006 1:46 AM
sangminny  Wednesday, August 23, 2006 2:11 AM

thanks for your replay ..

but this was not helpful ..

It Can't work with all files ..

for examble i tried to open :

c:\windows\explorer.exe

c:\windows\system32\shell32.dll

it says : the specified file is not a .net assembely ..

and it's made only to take icons from .net Programs only !!

waiting for a solution ..

regards , and thanks

mohdtmn  Wednesday, August 23, 2006 2:47 AM
There is a API to extract icon, you can try. To call this API, you need import shell32.dll
HICON ExtractIcon(
   HINSTANCE hInst,
   LPCTSTR lpszExeFileName,
   UINT nIconIndex
);
Wang Chi  Wednesday, August 23, 2006 5:26 AM

I have a bit of code that uses windows ImageList cache, but it's way to big to put here.

Contact me at andrew(dot)vos(at)gmail.com and I'll send you the source... (It's in vb.net)

It can extract small, medium and large icons from associated files.

Oh wait a minute, from exe files this will only extract the associated icon :( sorry.

AndrewVos  Wednesday, August 23, 2006 7:41 AM

Check out Steves' Icon Extractor utility, really nice implementation...

http://www.vbaccelerator.com/home/NET/Utilities/Icon_Extractor/article.asp

Dylan Morley  Thursday, August 24, 2006 12:27 PM

Wang Chi
how to do it in vb.net ? i really tried ..

AndrewVos
I Sent you an e-mail

Dylan Morley
That's a very nice sample , but it's in c language also it's made for vs 2002 and when i converted it to vs 2005 the project is full with problems ..

 

thanks guys for help ..

regards .

mohdtmn  Sunday, August 27, 2006 1:47 AM

You can use google to search for other answers

Custom Search

More Threads

• Accessing the DNS suffix?
• CancelButton problem
• Add line to top of richtextbox
• Windows Defender detects and removes spyware
• accessing windows components from class
• Listview control with up down arrows, any easy way to get this functionality?
• regarding merging of child menubar with parent in MDI having same menu item
• How to print the total number of pages on each page?
• Detecting edition mode
• Adding ContextMenu menu to a ToolStripMenuItem