File Association Example
In the following example, a hypothetical software development company called Litware, Inc. creates a new audio player called LitwarePlayer. Litware wants to design a file association between LitwarePlayer and its primary file type, which uses a newly developed audio format that enables an entire audio CD to be stored in less than 10 kilobytes of memory with no loss of quality.
The company should take the following steps.
- Decide if the new file type should be treated as public or private. This new file type is a media type. Because users exchange media files across various platforms and there might be other applications that need to read the LitwarePlayer format, a public file type is the most appropriate.
- Determine whether this file type is already defined. Check the Internet Assigned Numbers Authority (IANA) MIME database, and other public file type databases on the Internet to determine that no comparable file type has been defined. Because this is a new file format, you need to define a new file type.
- Define a file name extension for the new file type. The developers choose the
.opa-ltw-audio, which incorporates their vendor abbreviation and a hint about the what the file contains. Research determines that the extension is not being used by anyone else. Following current recommendations, no short extension is defined.
- Define a MIME type for the file type and register it with the IANA. Litware defines the new MIME type as audio/LitwarePlayer.1 and prepares a MIME type application, following the guidelines laid out in Request for Comments (RFC) numbers 2045, 2046, 2047, and 2048. They then submit the application to the IANA, which adds the new file type to the database of registered MIME types.
- Determine whether a ProgID exists for the file type. Because this is a new file type, no ProgID exists for it. Litware sets about designing a new ProgID for LitwarePlayer. They decide on the friendly name "LitwarePlayer Audio Player" (which is stored as a resource in the LitwarePlayer.exe file), and they design a default icon to use for files associated with LitwarePlayer (also stored in LitwarePlayer.exe). Because LitwarePlayer is a new application, this is a version 1 ProgID.
- Register the ProgID. When LitwarePlayer is installed, the installation program creates the following ProgID entry in the registry.
HKEY_CLASSES_ROOT Litware.LitwarePlayer.1 (Default) = LitwarePlayer Audio Player FriendlyTypeName = @LitwarePlayer, -120 CurVer (Default) = Litware.LitwarePlayer.1 DefaultIcon (Default) = LitwarePlayer, -142 shell play command (Default) = "%ProgramFiles%\LitwarePlayer\LitwarePlayer.exe" "%1"
In the command key, %1 is passed as the path to the file to play.
- Register the file name extension for the file type. When LitwarePlayer is installed, the installation program creates the following entries in the registry for its custom file type extension.
HKEY_CLASSES_ROOT .opa-vwi-audio (Default) = Litware.LitwarePlayer.1 PerceivedType = Audio Content Type = audio/LitwarePlayer
- Introduction to File Associations
- How to Register an Internet Browser or Email Client With the Windows Start Menu
- Registering an Application to a URI Scheme
- Best Practices for File Associations
- Guidelines for Managing Default Applications in Windows Vista and Later
- Default Programs
- Set Program Access and Computer Defaults (SPAD)