Requests information about the persistence interface implemented by the run-time object.
HRESULT QueryPersistenceInterface(
REFIID riid
);
Parameter
riid
[in] Identifier of a persistence interface. Possible values are as follows:
Interface Identifier | Meaning |
IID_IPersistFile | File persistence. |
IID_IPersistStorage | Storage persistence. |
IID_IPersistStream | Stream persistence. |
IID_IPersistStreamInit | Stream persistence with initialization. |
Return Values
The designer returns one of the following values:
Return Value | Meaning |
S_OK | The designer supports the specified persistence interface. |
S_FALSE | The designer does not support the specified persistence interface. |
E_FAIL | The method failed for an unknown reason. |
E_INVALIDARG | The argument is invalid. |
E_NOTIMPL | The design-time and run-time objects are the same. |
E_OUTOFMEMORY | Not enough memory is available to complete the operation. |
Comments
The designer implements this method.
The host uses this method together with the SaveRuntimeState method to save persistent data needed later to create and load the run-time object. It asks the visual designer for persistence interfaces in order of preference.
The persistence interface requested depends on the host; different hosts request different interfaces. Visual Basic versions 5.0 and later, for example, do not use file persistence.
Example
The following example implements QueryPersistenceInterface for an ActiveX designer that supports three persistence interfaces:
STDMETHODIMP CMyDesigner::QueryPersistenceInterface
(
REFIID riid
)
{
if (riid == IID_IPersistStreamInit)
return S_OK;
else if (riid == IID_IPersistStorage)
return S_OK;
else if (riid == IID_IPersistStream)
return S_OK;
else
return S_FALSE;
}