Compartir a través de


Programmatic Identifiers

The Shell uses a ProgID registry key to associate a file type with an application and to control the behavior of the association. The ProgID entries used for file associations exist in the registry under HKEY_CLASSES_ROOT .

  • PROGID Elements Used by File Associations
  • Using Versioned PROGIDs
  • System Reserved PROGIDs and Extensions

PROGID 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 (see Using Versioned PROGIDs).

A ProgID key should include the following elements. Note that some string values in this key require specific formatting.

  • Default Value. Set the default value of the ProgID key to a friendly name for that ProgID, suitable to display to the user. The use of this value to hold the friendly name is depreciated by FriendlyTypeName on systems running Microsoft Windows 2000 or later. However, you should set this value for backward compatibility.
  • EditFlags. Set this optional value using flags from the FILETYPEATTRIBUTEFLAGS enumeration. The EditFlags value controls some aspects of the Shell's handling of the file types linked to this ProgID. You can also use the EditFlags value 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 as in a bitwise OR operation. This is a REG_DWORD or REG_BINARY value.
  • FriendlyTypeName. Set this value to a friendly name for the ProgID, suitable to display to the user. For consistency, this string should contain the same value as the default value of the ProgID key. This value 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 value to a brief help message that the Shell displays for this ProgID. The InfoTip displays as the contents of 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 value of this subkey to the most current version of this ProgID.
  • DefaultIcon. Set the default value 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 is an example of a file association ProgID key node.

HKEY_CLASSES_ROOT

Vendor.comp.1

(Default) = My Friendly Name
EditFlags [REG_DWORD] = 0x00000001
FriendlyTypeName [REG_EXPAND_SZ] = @%SystemRoot%\shell32.dll,-154
InfoTip [REG_EXPAND_SZ] = @%SystemRoot%\shell32.dll,-54

  • CurVer
  • DefaultIcon

Using Versioned PROGIDs

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. You should always use versioned ProgIDs, even if there is only one version of the ProgID. This helps avoid conflicts and enables different versions of an application to coexist without the need to overwrite ProgIDs.

System Reserved PROGIDs and Extensions

The system reserves the following ProgIDs.

  • CD Audio
  • DVD/DVDVideo
  • Directory
  • Folder
  • Drive