共用方式為


IPersistStorageImpl Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at IPersistStorageImpl Class.

This class implements the IPersistStorage interface.

Important

This class and its members cannot be used in applications that execute in the Windows Runtime.

Syntax

template <class T>  
class ATL_NO_VTABLE IPersistStorageImpl : public IPersistStorage

Parameters

T
Your class, derived from IPersistStorageImpl.

Members

Public Methods

Name Description
IPersistStorageImpl::GetClassID Retrieves the object's CLSID.
IPersistStorageImpl::HandsOffStorage Instructs the object to release all storage objects and enter HandsOff mode. The ATL implementation returns S_OK.
IPersistStorageImpl::InitNew Initializes a new storage.
IPersistStorageImpl::IsDirty Checks whether the object's data has changed since it was last saved.
IPersistStorageImpl::Load Loads the object's properties from the specified storage.
IPersistStorageImpl::Save Saves the object's properties to the specified storage.
IPersistStorageImpl::SaveCompleted Notifies an object that it can return to Normal mode to write to its storage object. The ATL implementation returns S_OK.

Remarks

IPersistStorageImpl implements the IPersistStorage interface, which allows a client to request that your object load and save its persistent data using a storage.

The implementation of this class requires class T to make an implementation of the IPersistStreamInit interface available via QueryInterface. Typically this means that class T should derive from IPersistStreamInitImpl, provide an entry for IPersistStreamInit in the COM map, and use a property map to describe the class's persistent data.

Related Articles ATL Tutorial, Creating an ATL Project

Inheritance Hierarchy

IPersistStorage

IPersistStorageImpl

Requirements

Header: atlcom.h

IPersistStorageImpl::GetClassID

Retrieves the object's CLSID.

STDMETHOD(GetClassID)(CLSID* pClassID);

Remarks

See IPersist::GetClassID in the Windows SDK.

IPersistStorageImpl::HandsOffStorage

Instructs the object to release all storage objects and enter HandsOff mode.

STDMETHOD(HandsOffStorage)(void);

Return Value

Returns S_OK.

Remarks

See IPersistStorage::HandsOffStorage in the Windows SDK.

IPersistStorageImpl::InitNew

Initializes a new storage.

STDMETHOD(InitNew)(IStorage*);

Remarks

The ATL implementation delegates to the IPersistStreamInit interface.

See IPersistStorage:InitNew in the Windows SDK.

IPersistStorageImpl::IsDirty

Checks whether the object's data has changed since it was last saved.

STDMETHOD(IsDirty)(void);

Remarks

The ATL implementation delegates to the IPersistStreamInit interface.

See IPersistStorage:IsDirty in the Windows SDK.

IPersistStorageImpl::Load

Loads the object's properties from the specified storage.

STDMETHOD(Load)(IStorage* pStorage);

Remarks

The ATL implementation delegates to the IPersistStreamInit interface. Load uses a stream named "Contents" to retrieve the object's data. The Save method originally creates this stream.

See IPersistStorage:Load in the Windows SDK.

IPersistStorageImpl::Save

Saves the object's properties to the specified storage.

STDMETHOD(Save)(IStorage* pStorage, BOOL fSameAsLoad);

Remarks

The ATL implementation delegates to the IPersistStreamInit interface. When Save is first called, it creates a stream named "Contents" on the specified storage. This stream is then used in later calls to Save and in calls to Load.

See IPersistStorage:Save in the Windows SDK.

IPersistStorageImpl::SaveCompleted

Notifies an object that it can return to Normal mode to write to its storage object.

STDMETHOD(SaveCompleted)(IStorage*);

Return Value

Returns S_OK.

Remarks

See IPersistStorage:SaveCompleted in the Windows SDK.

See Also

Storages and Streams
IPersistStreamInitImpl Class
IPersistPropertyBagImpl Class
Class Overview