Редагувати

Поділитися через


Programmatic Identifiers

The Shell uses a programmatic identifier (ProgID) registry subkey to associate a file type with an application, and to control the behavior of the association. The ProgID entries used for file associations are located under HKEY_CLASSES_ROOT in the registry.

This topic is organized as follows:

For additional information, read How To Register a File Type for a New Application

Programmatic Identifier Elements Used by File Associations

The proper format of a ProgID key name is [Vendor or Application].[Component].[Version], separated by periods and with no spaces, as in Word.Document.6. The Version portion is optional but strongly recommended. For more information, see Using Versioned Programmatic Identifiers.

A ProgID subkey should include the following elements. Note that some string data in this key requires specific formatting.

Element Description
(Default) Set the default entry of the ProgID subkey to a friendly name for that ProgID, suitable to display to the user. The use of this entry to hold the friendly name is deprecated by the FriendlyTypeName entry on systems running Windows 2000 or later. However, you should set this value for backward compatibility.
AllowSilentDefaultTakeOver (introduced in Windows 8) Set this optional entry to signal that Windows should ignore this ProgID when determining a default handler for a public file type. Regardless of whether this value is set, the ProgID continues to appear in the OpenWith shortcut menu and dialog. This is a REG_NONE value.
AppUserModelID (introduced in Windows 7) Set this optional entry to the application's explicit Application User Model ID (AppUserModelID) if the application uses an explicit AppUserModelID and uses either the system's automatically generated Recent or Frequent Jump Lists or provides a custom Jump List. If an application uses an explicit AppUserModelID and does not set this value, items will not appear in that application's Jump Lists. This is a REG_SZ string. For more information, see Application User Model IDs (AppUserModelIDs).
EditFlags Set this optional entry using flags from the FILETYPEATTRIBUTEFLAGS enumeration. The EditFlags entry controls some aspects of the Shell's handling of the file types linked to this ProgID. You can also use the EditFlags entry to limit how much the user can modify certain aspects of these file types using a file's property sheet. The FILETYPEATTRIBUTEFLAGS values used for EditFlags are binary values designed so that you can combine multiple attributes into a single value in a bitwise OR operation. This is a REG_DWORD or REG_BINARY value.
FriendlyTypeName Set this entry to a friendly name for the ProgID, suitable to display to the user. For consistency, this string should contain the same data as the Default entry for this ProgID key. This entry can be either a REG_SZ or REG_EXPAND_SZ string, but it must be formatted as an indirect string (a fully qualified file name and resource value preceded by the @ symbol), for instance @%SystemRoot%\shell32.dll,-154.
InfoTip Set this entry to a brief help message that the Shell displays for this ProgID. The InfoTip entry displays in a mouse-over dialog box. This value can be either a REG_SZ or REG_EXPAND_SZ string but, like FriendlyTypeName, it must be formatted as an indirect string.
CurVer Set the (Default) entry of this subkey to the most current version of this ProgID.
Note: Unless you have side-by-side application versions, that is, multiple versions installed on the same system, you should avoid using CurVer.
DefaultIcon. Set the (Default) entry of this subkey to the default icon that you want to display for file types associated with this ProgID. This value can be either a REG_SZ or REG_EXPAND_SZ string, but it must be provided as a fully qualified file name with its attendant resource value, for instance %SystemRoot%\shell32.dll,-154.

 

The following registry key example illustrates a file association ProgID key node:

HKEY_CLASSES_ROOT
   Vendor.App.1
      (Default) = My Friendly Name
      AllowSilentDefaultTakeOver
      AppUserModelID = Vendor.Application
      EditFlags = 0x00000001
      FriendlyTypeName = @%SystemRoot%\shell32.dll,-154
      InfoTip = @%SystemRoot%\shell32.dll,-54
      CurVer
         (Default) = Vendor.App.1
      DefaultIcon
         (Default) = %SystemRoot%\shell32.dll,-1

Using Versioned Programmatic Identifiers

A versioned ProgID is one whose version is indicated in its name. You typically do this by adding a period and the version number to the name. For example:

  • Word.Document.6
  • Word.Document.8

These are versioned ProgIDs, with versions 6 and 8 respectively. If you have a side-by-side application, that is, one that supports multiple versions of your application installed at the same time, then use CurVer and Version Independent ProgIDs. Otherwise, CurVer and Version Independent ProgIDs should be avoided because they will lead to inefficiency.

How To Register a File Type for a New Application

Application Registration

File Types

How File Associations Work

Content View By File Type or Kind

File Type Verifier

File Type Handlers

Perceived Types

Association Arrays