- ITypeInfo interface (oaidl.h)
- Inheritance
- Methods
- Remarks
- Идентификация типов файлов, файлов и папок Identify File Types, Files, and Folders
- How to Register a File Type for a New Application
- Instructions
- Step 1:
- Step 2:
- Step 3:
- Step 4:
- Remarks
- File Type Handlers
- Make a File Type Known to Shell
- File Type Handler Descriptions
- File Types
- Public and Private File Types
- Registering a File Type
- Setting Optional Subkeys and File Type Extension Attributes
- Deleting Registry Information During Uninstallation
- File Types That Support Open Metadata
ITypeInfo interface (oaidl.h)
This section describes ITypeInfo, an interface typically used for reading information about objects. For example, an object browser tool can use ITypeInfo to extract information about the characteristics and capabilities of objects from type libraries.
Inheritance
The ITypeInfo interface inherits from the IUnknown interface. ITypeInfo also has these types of members:
Methods
The ITypeInfo interface has these methods.
Method | Description |
---|---|
ITypeInfo::AddressOfMember | Retrieves the addresses of static functions or variables, such as those defined in a DLL. |
ITypeInfo::CreateInstance | Creates a new instance of a type that describes a component object class (coclass). |
ITypeInfo::GetContainingTypeLib | Retrieves the containing type library and the index of the type description within that type library. |
ITypeInfo::GetDllEntry | Retrieves a description or specification of an entry point for a function in a DLL. |
ITypeInfo::GetDocumentation | Retrieves the documentation string, the complete Help file name and path, and the context ID for the Help topic for a specified type description. |
ITypeInfo::GetFuncDesc | Retrieves the FUNCDESC structure that contains information about a specified function. |
ITypeInfo::GetIDsOfNames | Maps between member names and member IDs, and parameter names and parameter IDs. |
ITypeInfo::GetImplTypeFlags | Retrieves the IMPLTYPEFLAGS enumeration for one implemented interface or base interface in a type description. |
ITypeInfo::GetMops | Retrieves marshaling information. |
ITypeInfo::GetNames | Retrieves the variable with the specified member ID or the name of the property or method and the parameters that correspond to the specified function ID. |
ITypeInfo::GetRefTypeInfo | If a type description references other type descriptions, it retrieves the referenced type descriptions. |
ITypeInfo::GetRefTypeOfImplType | If a type description describes a COM class, it retrieves the type description of the implemented interface types. |
ITypeInfo::GetTypeAttr | Retrieves a TYPEATTR structure that contains the attributes of the type description. |
ITypeInfo::GetTypeComp | Retrieves the ITypeComp interface for the type description, which enables a client compiler to bind to the type description’s members. |
ITypeInfo::GetVarDesc | Retrieves a VARDESC structure that describes the specified variable. |
ITypeInfo::Invoke | Invokes a method, or accesses a property of an object, that implements the interface described by the type description. |
ITypeInfo::ReleaseFuncDesc | Releases a FUNCDESC previously returned by ITypeInfo::GetFuncDesc. |
ITypeInfo::ReleaseTypeAttr | Releases a TYPEATTR previously returned by ITypeInfo::GetTypeAttr. |
ITypeInfo::ReleaseVarDesc | Releases a VARDESC previously returned by ITypeInfo::GetVarDesc. |
Remarks
Type information interfaces are intended to describe the parts of the application that can be called by outside clients, rather than those that might be used internally to build an application.
The ITypeInfo interface provides access to the following:
- The set of function descriptions associated with the type. For interfaces, this contains the set of member functions in the interface.
- The set of data member descriptions associated with the type. For structures, this contains the set of fields of the type.
- The general attributes of the type, such as whether it describes a structure, an interface, and so on.
The type description of an IDispatch interface can be used to implement the interface. For more information, see the description of CreateStdDispatch in Dispatch Interface and API Functions.
An instance of ITypeInfo provides various information about the type of an object, and is used in different ways. A compiler can use an ITypeInfo to compile references to members of the type. A type interface browser can use it to find information about each member of the type. An IDispatch implementor can use it to provide automatic delegation of IDispatch calls to an interface.
Идентификация типов файлов, файлов и папок Identify File Types, Files, and Folders
При планировании миграции , если не MigDocs.xml, необходимо определить типы файлов, файлы, папки и параметры, которые необходимо перенести. When planning for your migration, if not using MigDocs.xml, you should identify the file types, files, folders, and settings that you want to migrate. Сначала необходимо определить стандартные расположения файлов на каждом компьютере, например «Мои документы». First, you should determine the standard file locations on each computer, such as My Documents. , C:\Data и указанные компанией расположения, такие как \EngineeringDrafts. , C:\Data , and company-specified locations, such as \EngineeringDrafts. Затем необходимо определить и найти нестандартные расположения. Next, you should determine and locate the non-standard locations. Для нестандартных местоположений рассмотрите следующие вопросы: For non-standard locations, consider the following:
Типы файлов. File types. Подумайте, какие типы файлов необходимо включить и исключить из миграции. Consider which file types need to be included and excluded from the migration. Этот список можно создать на основе распространенных приложений, используемых в организации. You can create this list based on common applications used in your organization. Приложения обычно используют определенные расширения имен файлов. Applications normally use specific file name extensions. Например, MicrosoftOffice Word в основном использует расширение DOC, DOCX и DOTX. For example, MicrosoftOffice Word primarily uses .doc, .docx and .dotx file name extension. Однако он также использует другие типы файлов, например шаблоны (DOT-файлы), реже. However, it also uses other file types, such as templates (.dot files), on a less frequent basis.
Исключенные расположения. Excluded locations. Рассмотрите расположения на компьютере, которые следует исключить из миграции (например, %WINDIR% и Program Files). Consider the locations on the computer that should be excluded from the migration (for example, %WINDIR% and Program Files).
Новые расположения. New locations. Определите, куда следует перенести файлы на компьютер назначения, например \My Documents, назначенную папку или папку, которая соответствует имени и расположению файлов на компьютере источника. Decide where files should be migrated to on the destination computer for example, \My Documents, a designated folder, or a folder matching the files’ name and location on the source computer. Например, у вас могут быть общие данные на компьютере-источнике или вы можете очистить документы за пределами профилей пользователей в этой системе. For example, you might have shared data on source machine or you might wish to clean up documents outside the user profiles on the source system. Определите все данные, которые должны быть перенаправлены в новое расположение на этапе применения. Identify any data that needs to be redirected to a new location in the apply phase. Это можно сделать с помощью правил изменения расположения. This can be accomplished with location modify rules.
После проверки типов файлов и файлов, с которыми пользователи регулярно работают, необходимо найти их. Once you have verified which files and file types that the end users work with regularly, you will need to locate them. Файлы могут быть сохранены в одной папке или на диске. Files may be saved to a single folder or scattered across a drive. Отправной точкой для поиска типов файлов, которые необходимо включить, является просмотр зарегистрированных типов файлов на компьютере. A good starting point for finding files types to include is to look at the registered file types on the computer.
Поиск зарегистрированных типов файлов на компьютере под управлением Windows7 или Windows8 To find the registered file types on a computer running Windows7 or Windows8
Нажмите Начать. Click Start. Откройте панель управления, щелкните «Домашняя панельуправления» и выберите «Программы». Open Control Panel, click Control Panel Home, and click Programs.
Щелкните «Программы по умолчанию» и выберите «Связать тип файла или протокол с программой». Click Default Programs, and click Associate a file type or protocol with a program.
На этом экране отображаются зарегистрированные типы файлов. On this screen, the registered file types are displayed.
How to Register a File Type for a New Application
If you plan to associate one or more file types with a new application, you must define a ProgID for each file type that you want to associate with the application.
To create a ProgID for each unique file type that your application handles, use these steps.
Instructions
Step 1:
Note that some file types have multiple extensions that point to the same ProgID; for example:
- HKEY_CLASSES_ROOT\App.jpeg (your ProgID)
- HKEY_CLASSES_ROOT\.jpg = App.jpeg (the file type mappings)
- HKEY_CLASSES_ROOT\.jpeg = App.jpeg
Step 2:
Remove the ProgID values when you install and uninstall your program.
Step 3:
Leave the file type mappings unchanged at uninstall time. Doing so works because file type mappings are stored per user in HKEY_CLASSES_ROOT\.ext, and the system identifies the case where the ProgID value is missing and ignores it. Leaving file type mappings unchanged avoids the need to have conditional code that only removes the file type mapping if the value still points to your ProgID. It is important to avoid doing so in cases where it might have been changed by another application and you thus cannot easily remove the value.
Step 4:
Specify a unique value for the file type description of each file type ProgID by doing one of the following:
- Leave the default value of the ProgID empty, in which case the system uses the .ext file.
- Provide a localized value via FriendlyTypeName and, for compatibility with old applications that read the registry directly, be sure to provide the default value of the ProgID as the file type description (that is, use the same value that is referred to by the FriendlyTypeName in the English resource).
Remarks
If you plan to associate the file with an existing application, locate an application ProgID in the registry. For more information, see File Types.
File Type Handlers
Registering a file type is the first step in creating a file association, which makes that file type «known» to the Shell. However, without file type handlers, the Shell is unable to expose information to the user from and about the file.
This topic is organized as follows:
Make a File Type Known to Shell
In the following screen shot of Windows Explorer, the image file Desert.known appears in the Shell Pictures library, and is associated only with the Paint application.
The Desert.known file in the preceding screen shot lacks the following functionality that is enabled by a file type handler:
- Thumbnail or preview
- Image-specific verbs in the shortcut menu, such as:
- Rotate Preview
- Set as Desktop Background
- Image-specific properties in the Details pane, such as:
- Date Taken
- Tags
- Rating
- Indexing of file text
In the following screen shot, the same file (Desert.known) has the .jpg extension, which is a registered file type that has associated file type handlers, so a thumbnail image and more properties are shown.
File Type Handler Descriptions
The functionality provided by each file type handler is listed in the following table:
File Types
This topic explains how to create new file types and how to associate your app with your file type and other well-defined file types. Files with a shared common file name extension (.doc, .html, and so on) are of the same type. For example, if you create a new text editor, then you can use the existing .txt file type. In other cases, you might need to create a new file type.
This topic is organized as follows:
Additional information can be found on the following topics:
Public and Private File Types
Public file types are also known as popular or contentious types because competing applications might want to be associated with these file types. Characteristics of public file types include:
- They are typically defined by standards bodies, and/or are promoted by their defining organizations as interchange formats.
- They are often exchanged between computers and users for diverse purposes.
- They need to be supported on many different platforms.
- Applications from multiple vendors are likely to handle them.
Some examples of file types that are considered public are the image file types .png, .gif, .jpg, and .bmp, and the audio types .wav, .mp3, and .au.
Unlike public file types, private or proprietary file types typically have a format that is implemented and understood by only one application or vendor. As a result, private file types are typically not prone to conflicts between applications. Some file types can start as private file types but later become public file types.
Windows does not differentiate between public and private file types. The distinction is relevant only in making decisions about your choice of file type registration.
Registering a File Type
To associate the file type with an existing application, locate the application ProgID in the registry. To associate the file type with a new application, define a ProgID for your application. For information about defining a new ProgID, see Programmatic Identifiers.
File name extension subkeys have the following general form: extension=ProgID. File name extension subkeys are stored in the HKEY_CLASSES_ROOT subtree.
It is important to include the leading period (.) when creating file type subkeys in the registry. For example, if you want a file type with the short extension .myp and the long extension .myp-file to be opened with an application called MyProgram, use the following syntax:
As demonstrated in the preceding example, if you also register a short file name extension (.myp), you should create a subkey for the long extension (.myp-file) as well. For more information, see File Type Handlers.
Setting Optional Subkeys and File Type Extension Attributes
File type extension entries in the registry have several optional subkeys and attributes.
The file type extension entries that are used by file associations are described in the following table. All values are of the REG_SZ type.
Registry entry | Action |
---|---|
Default | Set the default value of the extension subkey to the ProgID to which it is linked. |
Content Type | Set the Content Type value to the file type’s MIME content type. |
OpenWithList | Do not use. This subkey contains one or more application subkeys for applications that appear in the Open with dialog box entry for the file type and is intended only for .exe applications on operating systems prior to WindowsВ XP. Use OpenWithProgIds instead. |
OpenWithProgIds | This subkey contains a list of alternate ProgIDs for this file type. The programs for these ProgIDs appear in the Open with menu and are available as default Windows Store apps for the file type. Whenever an application takes over this file type by changing the default value, it should also add an entry to this list. |
PerceivedType | Set the PerceivedType value to the PerceivedType to which the file belongs, if any. This string is not used by Windows versions prior to WindowsВ Vista. For more information, see Perceived Types and Application Registration. |
The general form of a file name extension subkey is as follows. All entry types are of the REG_SZ type.
Important considerations about file types include:
The HKEY_CLASSES_ROOT subtree is a view formed by merging HKEY_CURRENT_USER\Software\Classes and HKEY_LOCAL_MACHINE\Software\Classes
In general, HKEY_CLASSES_ROOT is intended to be read from but not written to. For more information, see the HKEY_CLASSES_ROOT article.
To register a file type globally on a particular computer, create an entry for the file type in the HKEY_LOCAL_MACHINE\Software\Classes subkey.
To make a file type registration visible to the current user only, create an entry for the file type in the HKEY_CURRENT_USER\Software\Classes subkey.
An application can provide its own implementation of a verb, such as open or play, as shown in the following registry example.
Subkeys of the verb subkey include the command line and the drop target method: command and DropTarget.
When you create or change a file association, it is important to notify the system that you have made a change. Do so by calling SHChangeNotify and specifying the SHCNE_ASSOCCHANGED event. If you do not call SHChangeNotify, the change may not be recognized until after the system is rebooted.
To retrieve registry information regarding a file association, use the IQueryAssociations interface. For a scenario that illustrates this procedure, see File Association Sample Scenario.
Both the App Paths and Applications registry subkeys are used to register and control the behavior of the system on behalf of applications. For more detailed information about this functionality, see Application Registration.
Deleting Registry Information During Uninstallation
When uninstalling an application, the ProgIDs and most other registry information associated with that application should be deleted as part of the uninstallation. However, applications that have taken ownership of a file type (by setting the Default value of the file type’s HKEY_CLASSES_ROOT\.extension subkey to the ProgID of the application) should not attempt to remove that value when uninstalling. Leaving the data in place for the Default value avoids the difficulty of determining whether another application has taken ownership of the file type and overwritten the Default value after the original application was installed. Windows respects the Default value only if the ProgID found there is a registered ProgID. If the ProgID is unregistered, it is ignored.
Note that other file-type ownership information is stored in the HKEY_CURRENT_USERsubtree and also is used only when the application that it references is registered. Therefore, this data does not need to be removed when uninstalling an application.
As an example, the following shows the state of the registry before an application is uninstalled:
The following shows the state of those same registry entries after the application has been uninstalled.
File Types That Support Open Metadata
In WindowsВ 7 and later, the following file types support open metadata.