How to find a files type and default icon path. RRS feed

  • Question

  • In Windows Explorer, in details view, there is a column called Type. It lists the files type. In my attempt to figure out how this is obtained I checked the registry.

    For a .xml file the Type column says "XML Document". I searched for the .xml key in hkey_classes_root and found it had a subkey called OpenWithProgid. The value was VisualStudio.XML.8.0.

    I searched for this key and it had a value with data "XML Document"
    So I figure this is how it is done but how would I implement it? I also want to get the file types default icon path.

    I am using vs2005. Thank you.
    Saturday, April 28, 2007 8:01 AM


All replies

  • This seems to be a good tutorial: Creating File Associations via the Registry (by Russell Judge @ vbCity)

    EDIT: that's a creation tutorial, but I'm assuming that the reverse operation of iterating through the registry-keys to read them, will give you the information that you want (filetype, description, icon).

    EDIT: hold on, it seems to be more complicated than that - I'll have another look

    Here's a more appropriate link to check: how do I find the default icon for a given file extension?

    Saturday, April 28, 2007 6:09 PM
  • What is the path of the default file icon. The icon that shows when no application is associated with a file.

    Edit: Also, whenever I extract an icon from a file it is the biggest size. How can I make it smaller? I want it about 8x8 or 16x16. Right now they come out around 48x48. Thanks.
    Friday, May 4, 2007 8:11 AM
  • The Windows/System32/Shell32.dll has a lot of the standard XP icons, and the first icon in there seems to be the 'default file' one. There's another dll that has a bunch too, but I've forgotten which one.

    A good icon-extractor should be able to help you with that - I found a C# one here: .NET Icon Explorer (by Steve McMahon), but there seem to be plenty of others around on VB.NET source sites.

    Friday, May 4, 2007 12:15 PM