3

This Super User Question described several methods how associate some specific program with file type. Now I want to know if there is a method to set a specific icon to files with a specific extension?

I.e. If we have file extension .myext and program MyProg, we need to set for all files with .myext icon of MyProg

I tried the methods described in the other question (Especially method with ASSOC) on Vista and Windows 7, but the file does not got icon

user37137
  • 183
  • 3
  • 4
  • 10

1 Answers1

3

Yes you can associate. (Otherwise icons would be limited to what Windows Explorer knows about.)

It is done in the registry.

Navigate to and expand HKEY_CLASSES_ROOT and create a key for your extension. Within this key create the default value with a name for the file type.

Again under HKEY_CLASSES_ROOT create a key for the file type. Under the file type key create a new key "DefaultIcon" and in that create the default value. This value should be either a path to an icon file, or to a exe/dll and a resource index.

Take a look at the registration for known file types already there to see how it is done. (There will also be other keys and values to cover launching the right program, COM (component object model) and other things associated with file types, you can ignore these.)

Richard
  • 9,172