How to get system icons and descriptions

Hi,

Would anyone tell me how to get the system registered icon and description of a file

For instance: *.doc (Word document, [MS-Word icon])

with tanks.




Answer this question

How to get system icons and descriptions

  • Degremont

    Hi!

    Did you try SHGetFileInfo() or ExtractAssociatedIconEx() functions from Win32 API



  • Monkletx1

    Yes, I did.

    But beacuase of 2 reasons i don't like to use them:

    1- I prefer a .NET way

    2- ExtractAssociatedIconEx() gives me an icon Handle which is not usable in .NET component. I don't know how to use this handle in a list view for example.

     

    Thanks for you suggesttion anyway.



  • Bapha

    1. Icon.ExtractAssociatedIcon() really solve your problem this time

    2. any handle easy used in .NET related classes by call to method like FromHandle() and Icon class also have ToBitmap() method that can help you to convert it to image if you need it.



  • laja

    Thanks my friend, you are great, man.

    Thanks a lot.



  • niv_7

    Unfortunately, these are the APIs you need to use. Maybe you can wrap them up nicely in a .NET class...

    If you use Icon.FromHandle you can convert that Handle to an Icon.



  • Michael Lowe

    Whoops! Forgot about Icon.ExtractAssociatedIcon

  • How to get system icons and descriptions