17

Possible Duplicate:
Get File Icon used by Shell

In my program i am reading a directory of files and displaying them as a ToolStripMenuItem

Normally i would use:

item.Image = Image.FromFile("icon.ico");

But how would i get the default icon that a given exe uses:

item.Image = Image.FromEXE("program.exe");

Is there a simple way to do it like that?

Community
  • 1
  • 1
  • From the list of related posts to the right on this page: http://stackoverflow.com/questions/462270/get-file-icon-used-by-shell – Fredrik Mörk Oct 08 '09 at 15:34

1 Answers1

12

See my previous question:
Get File Icon used by Shell

In summary, it's really simple. Just call Icon.ExtractAssociatedIcon().

Community
  • 1
  • 1
Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794