Asks 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 return value obtained from HRESULT is one of the following:
Return Value | Meaning |
S_OK | The designer supports the specified persistence interface. |
S_FALSE | The designer does not support the 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 | Out of memory. |
Comments
The persistence interface requested depends on the host; different hosts will request different interfaces. Visual Basic 5.0, for example, does not use file persistence.
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.
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; }