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

Categorizing by Container Capabilities

· 52CE 我爱测

Components often require certain functionality from the container and will not work with a container that does not provide the support.

Components often require certain functionality from the container and will not work with a container that does not provide the support. The user interface should filter out components that require functionality the container does not support. To accomplish this, components can be categorized by the required container functionality.

An example of components that require functionality from the container and do not work in containers that do not support that functionality are simple frame OLE controls. Categorizing by container capabilities is accomplished by an additional registry key within the component's CLSID key:

;The CLSID for "Simple Frame Control" is {123456FF-ABCD-4321-0101-00000000000C}HKEY_CASSES_ROOT\CLSID\{12346FF-ABCD-4321-0101-00000000000C}\Implemented Categories
;The CATID for "Control" is {40FC6ED4-2438-11cf-A3DB-080036F12502} HKEY_CLASSES_ROOT\CLSID\{123456FF-ABCD-4321-0101-00000000000C}Implemented Categories\{40FC6ED4-2438-11cf-A3DB-080036F12502}
;The CATID for simple frame controls is {...CATID_SimpleFrameControl...} HKEY_CLASSES_ROOT\CLSID\{123456FF-ABCD-4321-0101-00000000000C}Implemented Categories\{...CATID_SimpleFrameControl...}
HKEY_CLASSES_ROOT\CLSID\{123456FF-ABCD-4321-0101-00000000000C}Required Categories\{...CATID_SimpleFrameControl...}
 

As shown in this example, a component can belong to component categories that indicate supported functionality as well as to component categories that indicate required functionality.

In the following example, the button control is a generic OLE control that supports no additional functionality. It will work in any OLE control container.

HKEY_CLASSES_ROOT\CLSID\{...CLSID_Button...}\Implemented Categories
HKEY_CLASSES_ROOT\CLSID\{...CLSID_Button...}\Implemented Categories\{...CATID_Control...}
 

Compare the preceding example with the next example in which the MyDBControl can use Visual Basic data binding if the container supports it. However, it has been defined so that it will work in containers that do not support Visual Basic data binding (perhaps by a different database API):

HKEY_CLASSES_ROOT\CLSID\{...CLSID_MyDBControl...}\Implemented Categories
HKEY_CLASSES_ROOT\CLSID\{...CLSID_MyDBControl...}\Implemented Categories\{...CATID_Control...}
HKEY_CLASSES_ROOT\CLSID\{...CLSID_MyDBControl...}\Implemented Categories\{...CATID_VBDatabound...}
 

The GroupBox control is a simple frame control. It relies on the container implementing the ISimpleFrameSite interface and will work correctly only in such containers:

HKEY_CLASSES_ROOT\CLSID\{...CLSID_GroupBox...}\Implemented Categories
HKEY_CLASSES_ROOT\CLSID\{...CLSID_GroupBox...}\Implemented Categories\{...CATID_Control...}
HKEY_CLASSES_ROOT\CLSID\{...CLSID_GroupBox...}\Implemented Categories\{...CATID_SimpleFrame...}
HKEY_CLASSES_ROOT\CLSID\{...CLSID_GroupBox...}\Required Categories\{...CATID_SimpleFrame...}
 

A container that supports Visual Basic data bound controls but does not support simple frame controls would specify CATID_Control and CATID_VBDatabound to the insert control user interface. The list of controls displayed to the user would contain the CLSID_Button and CLSID_MyDBControl. CLSID_GroupBox would not be displayed.

Related topics

Associating Icons with a Category

Categorizing by Component Capabilities

Default Classes and Associations

Defining Component Categories

The Component Categories Manager

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)

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

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