大网数据广告活动
Windows 系统接口

Component Categories Manager Implementation

· 52CE 我爱测

As the number of available components grows, it becomes increasingly difficult to manage these components. In terms of the interfaces they expose as well as the tasks they perform, many components offer similar functionality.

As the number of available components grows, it becomes increasingly difficult to manage these components. In terms of the interfaces they expose as well as the tasks they perform, many components offer similar functionality.

It is often necessary to enumerate the components that can be used in a certain context. Examples of this are the Insert Object dialog box used in OLE compound documents and the Insert Control dialog box used in OLE controls. These dialog boxes list all components that fulfill (or claim to fulfill) the interface contracts for compound documents or controls. These existing categories (OLE document, OLE control) do not imply an exact interface signature. OLE documents have to expose a certain set of core interfaces (for example, IOleObject or IPersistStorage) but can also expose additional interfaces such as IOleLink.

In the past, components have been tagged by adding a human-readable name ("Insertable", "Control", and so on) as a subkey to the HKEY_CLASSES_ROOT\CLSID\{...} registry key corresponding to the component. This works well for a central definition of categories but risks name collisions when many independent parties define new categories. As in other areas of COM, the solution to providing an extensible namespace lies in the use of globally unique identifiers (GUIDs). Instead of using a human-readable name, a unique number (CATID) is assigned to each category.

Another limitation with the existing categorization is that it is limited to expressing the capabilities of the component itself. Many components require certain capabilities from the containers. When such a component is inserted into a container, the insertion can fail or behave unexpectedly, even though the component fulfills the contracts implied by one of its categories. To enumerate the components that can be used successfully in certain situations, the capabilities of both the component and the container must be considered.

Because of these considerations, the following changes were made to the existing categorization:

  • Categories are indicated by using CATIDs that are globally unique identifiers.
  • Under the Components subkey of the HKEY_CLASSES_ROOT\CLSID registry key, two separate subkeys, "Implemented Categories" and "Required Categories", were developed. These subkeys contain the lists of CATIDs that are provided by the component or that the container of the component must provide.

To ease managing the component categories, categories are listed in a central place in the registry: HKEY_CLASSES_ROOT\Component Categories. This key lists the installed categories both with their CATID and with localized, human-readable names.

For more information, see the following topics:

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。