Export (0) Print
Expand All
1 out of 2 rated this helpful - Rate this topic

IPersist interface

Provides the CLSID of an object that can be stored persistently in the system. Allows the object to specify which object handler to use in the client process, as it is used in the default implementation of marshaling.

IPersist is the base interface for three other interfaces: IPersistStorage, IPersistStream, and IPersistFile. Each of these interfaces, therefore, includes the GetClassID method, and the appropriate one of these three interfaces is implemented on objects that can be serialized to a storage, a stream, or a file. The methods of these interfaces allow the state of these objects to be saved for later instantiations, and load the object using the saved state. Typically, the persistence interfaces are implemented by an embedded or linked object, and are called by the container application or the default object handler.

When to implement

You must implement the single method of IPersist in implementing any one of the other persistence interfaces: IPersistStorage, 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.

Members

The IPersist interface inherits from the IUnknown interface. IPersist also has these types of members:

Methods

The IPersist interface has these methods.

MethodDescription
GetClassID

Retrieves the class identifier (CLSID) of the object.

 

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

ObjIdl.h

IDL

ObjIdl.idl

IID

IID_IPersist is defined as 0000010c-0000-0000-C000-000000000046

See also

IPersistFile
IPersistStorage
IPersistStream

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.