STGM

The STGM enumeration values are used in the storage and stream interfaces to indicate the conditions for creating and deleting the object and access modes for the object.

Defined in the ().

typedef enum tagSTGM
{
STGM_READ = OF_READ, // 0x0000
STGM_WRITE = OF_WRITE, // 0x0001
STGM_READWRITE = OF_READWRITE, // 0x0002

STGM_SHARE_DENY_NONE = OF_SHARE_DENY_NONE, // 0x0040
STGM_SHARE_DENY_READ = OF_SHARE_DENY_READ, // 0x0030
STGM_SHARE_DENY_WRITE = OF_SHARE_DENY_WRITE, // 0x0020
STGM_SHARE_EXCLUSIVE = OF_SHARE_EXCLUSIVE, // 0x0010

STGM_DIRECT = 0x00000000,
STGM_TRANSACTED = 0x00010000,

STGM_CREATE = OF_CREATE // 0x1000,
STGM_CONVERT = 0x00020000,
STGM_FAILIFTHERE = 0x00000000,

STGM_PRIORITY = 0x00040000,

STGM_DELETEONRELEASE = 0x04000000,

} STGM;

Elements

STGM_READ, STGM_WRITE, STGM_READWRITE

For stream objects, STGM_READ allows you to call the IStream::Read method. For storage objects, you can enumerate the storage elements and open them for reading.

STGM_WRITE lets you save changes to the object.

STGM_READWRITE is the combination of STGM_READ and STGM_WRITE.

STGM_SHARE_DENY_NONE, STGM_SHARE_DENY_READ, STGM_SHARE_DENY_WRITE, STGM_SHARE_EXCLUSIVE

STGM_SHARE_DENY_NONE specifies that subsequent openings of the object are not denied read or write access.

STGM_SHARE_DENY_READ prevents others from subsequently opening the object in STGM_READ mode. It is typically used on a root storage object.

STGM_SHARE_DENY_WRITE prevents others from subsequently opening the object in STGM_WRITE mode. This value is typically used to prevent unnecessary copies made of an object opened by multiple users. If this value is not specified, a snapshot copy must be made for each subsequent opening. Thus, you can improve performance by specifying this value.

STGM_SHARE_EXCLUSIVE is the combination of STGM_SHARE_DENY_READ and STGM_SHARE_DENY_WRITE.

STGM_DIRECT, STGM_TRANSACTED

In direct mode, each change to a storage element is written as it occurs. This is the default.

In transacted mode, changes are buffered and are written only if an explicit commit operation is called. The changes can be ignored by calling the Revert method in the IStream or IStorage interfaces. Transacted mode is not supported in the OLE-provided implementation of compound files.

STGM_CREATE, STGM_CONVERT, STGM_FAILIFTHERE

STGM_CREATE indicates that an existing storage object or stream should be removed before the new one replaces it. A new object is created when this flag is specified only if the existing object has been successfully removed.

STGM_CONVERT flag is used in three situations:

  • when you are trying to create a storage object on disk but a file of that name already exists

  • when you are trying to create a stream inside a storage object but a stream with the specified name already exists

  • when you are creating a byte array object but one with the specified name already exists

STGM_CONVERT creates the new object while preserving existing data in a stream named CONTENTS. In the case of a storage object or a byte array, the old data is flattened to a stream regardless of whether the existing file or byte array currently contains a layered storage object.

STGM_FAILIFTHERE causes the create operation to fail if an existing object with the specified name exists. In this case, STG_E_FILEALREADYEXISTS is returned. STGM_FAILIFTHERE applies to both storage objects and streams.

STGM_PRIORITY

Opens the storage object with exclusive access to the most recently committed version. Thus, other users cannot commit changes to the object while you have it open in priority mode. You gain performance benefits for copy operations but you prevent others from committing changes. So you should limit the time you keep objects open in priority mode. You must specify STGM_DIRECT and STGM_READ with priority mode.

STGM_DELETEONRELEASE

Indicates that the underlying file is to be automatically destroyed when the root storage object is released. This capability is most useful for creating temporary files.

Comments

You can combine these flags but you can only choose one flag from each group of related flags.

See Also

IStream::Read
.

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database