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

Class Monikers

· 52CE 我爱测

Although classes are typically identified directly with CLSIDs to functions such as CoCreateInstance or CoGetClassObject, classes may also now be identified with a moniker called a class moniker.

Although classes are typically identified directly with CLSIDs to functions such as CoCreateInstance or CoGetClassObject, classes may also now be identified with a moniker called a class moniker. Class monikers bind to the class object of the class for which they are created.

The ability to identify classes with a moniker supports useful operations that are otherwise unwieldy. For example, file monikers traditionally supported rich binding only to the class associated with the class of file they referred to; a moniker to an Excel file would bind to an instance of an Excel object, and a moniker to a GIF image would bind to an instance of the currently registered GIF handler. A class moniker allows you to indicate the class you want to use to manipulate a file through composition with a file moniker. A class moniker for a 3D charting class composed with a moniker to an Excel file yields a moniker that binds to an instance of the 3D charting object and initializes the object with the contents of the Excel file.

Class monikers are therefore most useful in composition with other types of monikers, such as file monikers or item monikers.

Class monikers may also be composed to the right of monikers supporting binding to the IClassActivator interface. When composed in this manner, IClassActivator simply gives access to the class object and instances of the class through IClassActivator::GetClassObject. Class monikers may be identified through IMoniker::IsSystemMoniker, which returns MKSYS_CLASSMONIKER in pdwMksys.

Programmers typically create class monikers using the CreateClassMoniker function or through MkParseDisplayName. (See IMoniker::ParseDisplayName for details.)

Related topics

Anti-Monikers

Composite Monikers

File Monikers

Item Monikers

Pointer Monikers

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)

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

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