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

Providing Class Information

· 52CE 我爱测

It is often useful for a client of an object to examine the object's type information. Given the object's CLSID, a client can locate the object's type library using registry entries and then can scan the type library for the coclass entry in the library matching the CLSID.

It is often useful for a client of an object to examine the object's type information. Given the object's CLSID, a client can locate the object's type library using registry entries and then can scan the type library for the coclass entry in the library matching the CLSID.

However, not all objects have a CLSID, although they still need to provide type information. In addition, it is convenient for a client to have a way to simply ask an object for its type information instead of going through all the tedium to extract the same information from registry entries. This capability is important when dealing with outgoing interfaces on connectable objects. (See Using IProvideClassInfo for more information on how connectable objects provide this capability.)

In these cases, a client can query the object for IProvideClassInfo or IProvideClassInfo2. If these interfaces exist, the client calls the GetClassInfo method to get the type information for the interface.

By implementing IProvideClassInfo or IProvideClassInfo2, an object specifies that it can provide type information for its entire class; that is, what it would describe in its coclass section of its type library, if it has one. GetClassInfo returns an ITypeInfo pointer corresponding to the object's coclass information. Through this ITypeInfo pointer, the client can examine all the object's incoming and outgoing interface definitions.

The object can also provide IProvideClassInfo2. The IProvideClassInfo2 interface is a simple extension to IProvideClassInfo that makes it quick and easy to retrieve an object's outgoing interface identifiers for its default event set. IProvideClassInfo2 is derived from IProvideClassInfo.

Related topics

COM Clients and Servers

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)

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

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