Click to return to the Component Development home page    
IPersistMemory::Load Meth...     IPersistPropertyBag Inter...     Component Interface Refer...    
Web Workshop  |  Component Development

IPersistMemory::Save Method


Instructs the object to save its persistent data to memory.

Syntax

HRESULT IPersistMemory::Save(
    void *pvMem, 
    BOOL fClearDirty, 
    ULONG cbSize
);

Parameters

pvMem
[in] Address of the memory in which the object should save up to cbSize bytes of its data. The object must not write past the address (BYTE*)((BYTE *)pvMem+cbSize).
fClearDirty
[in] Flag indicating whether the object should clear its dirty state on return from Save, or leave that state as is.
cbSize
[in] Amount of memory available at pvMem to which the object can write its data.

Return Value

Returns one of the following values:

S_OK The object successfully initialized itself.
E_UNEXPECTED This member was called before the object was initialized with IPersistMemory::InitNew or IPersistMemory::Load.
E_INVALIDARG The number of bytes indicated by cbSize is too small to allow the object to save itself completely.
E_POINTER The pointer in pvMem is NULL.

Remarks

Any object that implements IPersistMemory has some information to save persistently; therefore, E_NOTIMPL is not a valid return code.

The caller should ideally allocate as many bytes as the object returns from IPersistMemory::GetSizeMax.



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.