CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    HOW TO associate un icon to an extension ?

    Hi,

    In my project, the user can save files with different extensions, which are specific to my project : for example .ext1, .ext2, .ext3.

    Now, I would like to associate an icon to these extensions. I put icons in my ressources, but I don't know how to associate each of them with one of my files.

    The result will be that, when the user goes in the Windows Explorer, he sees the files with these extensions with specifics icons.

    Thanks for your help.

    Best Regards

    Stéph.



  2. #2
    Join Date
    May 1999
    Location
    WA
    Posts
    65

    Re: HOW TO associate un icon to an extension ?

    It sounds like rather than actually associating an icon to your extension, you need to register a file type in Windows. That way, you specify an icon for your file type, and it will do that for you automatically. If you are using a SDI or MDI based project, chances are that you already have a file type created for your project, and you will just have to modify the icon listed as IDR_MAINFRAME to get this to happen. Otherwise, if your app is dialog based, you will have to explicitly register a file type with Windows. Here is an excerpt from MSDN that may be of some guidance. Just lookup (or search) for "File Types" or "Registering File Types" and you will find some information..

    Registering a File Extension Type
    Windows CE Explorer, like Windows Explorer, allows you to customize a type name, as displayed in the details view of Explorer, and an icon for any file extension, for example, .pwd. File filters must be registered under HKEY_CLASSES_ROOT.

    The following is the structure of HKEY_CLASSES_ROOT:

    HKEY_CLASSES_ROOT\.<file extension>
    \(Default) = <Class Name>
    HKEY_CLASSES_ROOT\<Class Name>
    \(Default) = <Name to be displayed in the "Type" column of Explorer>
    \DefaultIcon = <filename or index of the icon for this type>

    Good luck!

    - Troy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured