TTypedComObject supports the IProvideClassInfo interface and is the class type for COM objects that can provide the type information without requiring a type library to be loaded.
TTypedComObject = class(TComObject, IProvideClassInfo);
class TTypedComObject : public TComObject, public IProvideClassInfo;
TTypedComObject supports the IProvideClassInfo interface which gives an object the ability to describe its interfaces and types when everything else about it, such as its class identifier (CLSID), is unknown. TTypedComObject requires a type library for the IProvideClassInfo interface. This class is designed to require a type library so that it can support dual interfaces, which are created by default.
IProvideClassInfo has a single method, GetClassInfo, which is implemented in TTypedComObject to provide access to the type information for the object's CoClass entry in its type library. This means that if the TTypedComObject has a running instance, a client can query for the IProvideClassInfo interface and retrieve this information without having to load and navigate a type library to find the ITypeInfo pointer for the object's CoClass.
Use TTypedComObject as a base class for objects that can conveniently provide type information without having to load a type library, such as an unknown object received through a drag-and-drop operation. The only objects that must implement IProvideClassInfo are those with custom events such as ActiveX controls.
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!