Skip to content

Latest commit

 

History

History
34 lines (19 loc) · 2.52 KB

providing-class-information.md

File metadata and controls

34 lines (19 loc) · 2.52 KB
title description ms.assetid ms.topic ms.date
Providing Class Information
Providing Class Information
808d9a39-4511-4aba-a23f-3c929970503b
article
05/31/2018

Providing Class Information

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