IStorage::OpenStorage method (objidl.h)
The OpenStorage method opens an existing storage object with the specified name in the specified access mode.
Syntax
HRESULT OpenStorage(
const OLECHAR *pwcsName,
IStorage *pstgPriority,
DWORD grfMode,
SNB snbExclude,
DWORD reserved,
IStorage **ppstg
);
Parameters
pwcsName
A pointer to a wide character null-terminated Unicode string that contains the name of the storage object to open. The 000 through 01f characters, serving as the first character of the stream/storage name, are reserved for use by OLE. This is a compound file restriction, not a structured storage restriction. It is ignored if pstgPriority is non-NULL.
pstgPriority
Must be NULL. A non-NULL value will return STG_E_INVALIDPARAMETER.
grfMode
Specifies the access mode to use when opening the storage object. For descriptions of the possible values, see STGM Constants. Other modes you choose must at least specify STGM_SHARE_EXCLUSIVE when calling this method.
snbExclude
Must be NULL. A non-NULL value will return STG_E_INVALIDPARAMETER.
reserved
Reserved for future use; must be zero.
ppstg
When successful, pointer to the location of an IStorage pointer to the opened storage object. This parameter is set to NULL if an error occurs.
Return value
This method can return one of these values.
Remarks
If the pstgPriority parameter is NULL, it is ignored. If the pstgPriority parameter is not NULL, it is an IStorage pointer to a previous opening of an element of the storage object, usually one that was opened in priority mode. The storage object should be closed and reopened according to grfMode. When the IStorage::OpenStorage method returns, pstgPriority is no longer valid. Use the value supplied in the ppstg parameter.
Storage objects can be opened with STGM_DELETEONRELEASE, in which case the object is destroyed when it receives its final release. This is useful for creating temporary storage objects.
Requirements
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 |
Library | Uuid.lib |
DLL | Ole32.dll |