Instructs the object to release all storage objects that have been passed to it by its container and to enter HandsOff mode, in which the object cannot do anything and the only operation that works is a close operation.

HRESULT HandsOffStorage(void);

Return Value


The object has successfully entered HandsOff mode.


This method causes an object to release any storage objects that it is holding and to enter the HandsOff mode until a subsequent IPersistStorage::SaveCompleted call. In HandsOff mode, the object cannot do anything and the only operation that works is a close operation.

A container application typically calls this method during a full save or low-memory full save operation to force the component object to release all pointers to its current storage. In these scenarios, the HandsOffStorage call comes after calling OleSave or IPersistStorage::Save for the component object; and it puts the component object in HandsOffAfterSave mode. Calling this method is necessary so the container application can delete the current file as part of a full save, or so it can call the IRootStorage::SwitchToFile method as part of a low-memory save.

A container application also calls this method when a component object is in Normal mode to put the component object in HandsOffFromNormal mode.

While the component object is in either HandsOff mode, most operations on the object will fail. Thus, the container should restore the component object to Normal mode as soon as possible. The container application does this by calling the IPersistStorage::SaveCompleted method, which passes a storage pointer back to the component object for the new storage object.

Notes to Implementors

This method must release all pointers to the component's current storage object, including pointers to any nested streams and storages. If the component object contains nested component objects, the container application must recursively call this method for any nested component objects that are loaded or running.

See Also

OleSave, IPersistStorage::Save, IPersistStorage::SaveCompleted, IRootStorage::SwitchToFile

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
Unix Manual Pages
Delphi Examples