IPersist

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This interface defines the single method GetClassID, which is designed to supply the class identifier (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 another interface, IPersistStorage. This interface, therefore, includes the GetClassID method, and is implemented on objects that can be serialized to a storage.

The methods of this interface allow the state of the object 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 the other persistence interface, IPersistStorage.

Typically, for example, you would implement IPersistStorage on an embedded object, although its uses are not limited to this object.

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

The following table shows the method for this interface.

Method Description

GetClassID

Retrieves the class identifier (CLSID) of an object. The CLSID is a unique value that identifies the code that can manipulate the persistent data.

Remarks

To determine whether the platform supports this interface, see Determining Supported COM APIs.

Requirements

Header objidl.h, objidl.idl
Library ole32.lib, uuid.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

IPersistStorage
IPersist::GetClassID