|
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.
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|