IPersist
The IPersist
interface defines the single method GetClassID, which is designed to
supply the CLSID of an object that can be stored persistently in the system. A
call to this method can allow the object to specify which object handler to use
in the client process, as it is used in the OLE default implementation of
marshaling.
IPersist is the base interface for three other interfaces: IPersistStorage
When to Implement
You must
implement the single method of IPersist in implementing any one of the
other persistence interfaces: IPersistStorageQIWSID, IPersistStream , or IPersistFile . Typically, for example,
you would implement IPersistStorage on an embedded object, IPersistFile
on a linked object, and IPersistStream on a new moniker class, although
their uses are not limited to these objects. You could implement IPersist
in a situation where all that is required is to obtain the CLSID of a
persistent object, as it is used in marshaling.
When to Use
The single
method of IPersist is rarely called directly in application code. It is
called by the default object handler to get the CLSID of an embedded object, or
an object to be marshaled. A container application, for example, would probably
not call the GetClassID method directly unless it provided object
handlers for specific classes of objects.
Methods in Vtable Order
IUnknown Methods |
Description |
QueryInterface |
Returns
pointers to supported interfaces. |
AddRef |
Increments
the reference count. |
Release |
Decrements
the reference count. |
IPersist
Method |
Description |
GetClassID |
Returns the
class identifier (CLSID) for the component object. |