Düzenle

Aracılığıyla paylaş


IStorage interface (objidl.h)

The IStorage interface supports the creation and management of structured storage objects. Structured storage allows hierarchical storage of information within a single file, and is often referred to as "a file system within a file". Elements of a structured storage object are storages and streams. Storages are analogous to directories, and streams are analogous to files. Within a structured storage there will be a primary storage object that may contain substorages, possibly nested, and streams. Storages provide the structure of the object, and streams contain the data, which is manipulated through the IStream interface.

The IStorage interface provides methods for creating and managing the root storage object, child storage objects, and stream objects. These methods can create, open, enumerate, move, copy, rename, or delete the elements in the storage object.

An application must release its IStorage pointers when it is done with the storage object to deallocate memory used. There are also methods for changing the date and time of an element.

There are a number of different modes in which a storage object and its elements can be opened, determined by setting values from STGM Constants. One aspect of this is how changes are committed. You can set direct mode, in which changes to an object are immediately written to it, or transacted mode, in which changes are written to a buffer until explicitly committed. The IStorage interface provides methods for committing changes and reverting to the last-committed version. For example, a stream can be opened in read-only mode or read/write mode. For more information, see STGM Constants.

Other methods provide access to information about a storage object and its elements through the STATSTG structure.

Inheritance

The IStorage interface inherits from the IUnknown interface. IStorage also has these types of members:

Methods

The IStorage interface has these methods.

 
IStorage::Commit

The Commit method ensures that any changes made to a storage object open in transacted mode are reflected in the parent storage.
IStorage::CopyTo

Copies the entire contents of an open storage object to another storage object.
IStorage::CreateStorage

Creates and opens a new storage object nested within this storage object with the specified name in the specified access mode.
IStorage::CreateStream

Creates and opens a stream object with the specified name contained in this storage object.
IStorage::DestroyElement

Removes the specified storage or stream from this storage object.
IStorage::EnumElements

The EnumElements method retrieves a pointer to an enumerator object that can be used to enumerate the storage and stream objects contained within this storage object.
IStorage::MoveElementTo

The MoveElementTo method copies or moves a substorage or stream from this storage object to another storage object.
IStorage::OpenStorage

Opens an existing storage object with the specified name in the specified access mode.
IStorage::OpenStream

Opens an existing stream object within this storage object in the specified access mode.
IStorage::RenameElement

The RenameElement method renames the specified substorage or stream in this storage object.
IStorage::Revert

The Revert method discards all changes that have been made to the storage object since the last commit operation.
IStorage::SetClass

The SetClass method assigns the specified class identifier (CLSID) to this storage object.
IStorage::SetElementTimes

The SetElementTimes method sets the modification, access, and creation times of the specified storage element, if the underlying file system supports this method.
IStorage::SetStateBits

The SetStateBits method stores up to 32 bits of state information in this storage object.
IStorage::Stat

The Stat method retrieves the STATSTG structure for this open storage object.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps | UWP apps]
Minimum supported server Windows 2000 Server [desktop apps | UWP apps]
Target Platform Windows
Header objidl.h

See also

EnumAll Sample

Samples