Introduction to File Associations
A file association enables you to control certain aspects of the Shell's treatment of different file types. These aspects include:
- Which application launches when a user double-clicks a file
- Which icon appears for a file by default
- How the file type appears when viewed in Microsoft Windows Explorer
- Which commands appear in a file's shortcut menu
- Other user interface (UI) features, such as ToolTips, tile info, and Webview details.
The Shell associates these aspects with file types, which are based on extensions. The Windows registry stores the data that define file associations.
In the following Windows Explorer window, the Shell displays different icons for each file, based on the icon associated with the file's type. If the user double-clicks the file My WordPad Document.doc, the Shell launches WordPad and uses it to open the file because, on this system, WordPad is associated with .doc files. You can control these actions using file associations.
Using File Associations
File associations provide a straightforward and useful way for users and developers to customize the Shell's treatment of defined file types.
Application developers can use file associations to link an application to one or more desired file types, and customize the Shell's treatment of that application's file type. For example, when the application installs, it can check for the existence of the appropriate file associations, and either create or override them as appropriate. The file association can then cause the Shell to display custom icons for files of the given types. The file association can also control how the Shell interprets user input for a file of a given type. For example, when a user double-clicks a file, the Shell launches the application and uses it to open the file. These are typical uses for file associations.
Expert users can use file associations to customize their user interface. These customizations can be functional, cosmetic, or both. An example of a cosmetic customization is when a user specifies that a different icon appear for a given file type, or changes the description that displays for a file type in Windows Explorer. An example of a functional customization is when a user chooses which application launches when the user double clicks a file of a certain file type. Users can modify file associations in three ways: by using the Edit File Type property sheet in Windows Explorer, by using the Open With dialog box, or by editing the registry.
When You Should Implement or Modify File Associations
Use file associations any time you need to control, extend, or modify the Shell's treatment of certain file types. For example, you can use file associations in any of the following situations.
- Establishing the Shell's default treatment of certain file types. Windows contains many default file associations.
- Controlling how the Shell treats certain types of files, both functionally and cosmetically.
- Linking an application to a certain file type which causes the application to take ownership of that file type.
- Extending or modifying the functions of shortcut menus for certain file types.