Home COM GDI+ WebBrowser Data Access

IPersist Interface

 

IID_IPersist

{0000010C-0000-0000-C000-000000000046}

 

 

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, 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.

 

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 reference count.

Release

Decrements reference count.

IPersist Method

Description

GetClassID

Returns the class identifier (CLSID) for the component object.

 

GetClassID

 

FUNCTION IPersist_GetClassID ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pClassID AS GUID _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[3] USING IPersist_GetClassID (pthis, pClassID) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

 

FUNCTION IPersist_GetClassID ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pClassID AS GUID _

  ) AS LONG
 

  ! mov  eax, pClassID
  ! push eax
  ! mov  eax, pthis
  ! push eax
  ! mov  eax, dword ptr[eax]
  ! call dword ptr[eax+12]
  ! mov  FUNCTION, eax


END FUNCTION

 

 

Page last updated on Wednesday, 15 March 2006 22:19:34 +0100