1

I want that a user can enter a filename and it shows him the "symbol" of the file.... like those ones: enter image description here

I know that I could extract them out of their dlls and add them to my project, but I think there could be a solution which grabs them out of windows... I would like to have a very simple implementation, because it'll be part of a school project and the examiners hate importing DLLs, it would be "unsafe", so , a function which is supported by C#'s default stuff would be very nice for me.

leAthlon
  • 734
  • 1
  • 10
  • 22

1 Answers1

0

I found something that is much much much easier than importing DLLs or such higher things.

  Icon.ExtractAssociatedIcon(filename);

it returns an icon, so you have to convert it to an Image:

 (Image)new ImageConverter().ConvertFrom(Icon.ExtractAssociatedIcon(filename));

It even extracts icons of .exe 's, which is even more than I asked for. I'm really happy that I can provide an easier answer. Thanks Stackoverflow

leAthlon
  • 734
  • 1
  • 10
  • 22