StgOpenPropStg

Opens a specified property set in a specified storage or stream object. The property set supplies the system-provided, standalone implementation of the IPropertyStorage interface.

HRESULT StgOpenPropStg(
  IUnknown* pUnk,    //Interface pointer for object containing the 
                     // requested property set
  REFFMTID fmtid,    //Format identifier of the property set to be 
                     // opened
  DWORD grfFlags,    //PROPSETFLAG values
  DWORD dwReserved,  //Reserved; must be zero
  IPropertyStorage** ppPropStg
                     //Address of output variable that receives the 
                     // IPropertyStorage interface pointer
);
 

Parameters

pUnk
[in] Interface pointer for IUnknown interface on the storage or stream object that contains the requested property set object.
fmtid
[in] Format identifier of the property set to be opened.
grfFlags
[in] Values from the PROPSETFLAG enumeration.
dwReserved
[in] Reserved for future use; must be zero.
ppPropStg
[out] Address of IPropertyStorage* pointer variable that receives the interface pointer to the requested property set.

Return Values

This function supports the standard return values E_INVALIDARG and E_UNEXPECTED, as well as the following:

S_OK
The property set was opened.
STG_E_FILENOTFOUND
A property set was not found in the specified object (pUnk).
STG_E_ACCESSDENIED
The requested access to the property storage object has been denied, or the property set is corrupted.
STG_E_INVALIDHEADER
The property set is corrupted.
STG_E_INSUFFICIENTMEMORY
There is not enough memory to perform this operation.
STG_E_INVALIDFLAG
A flag in the grfMode or grfFlags parameter was invalid.
STG_E_INVALIDPARAMETER
A parameter is invalid.

Remarks

StgOpenPropStg opens the requested property set and supplies the system-provided, standalone implementation of the IPropertyStorage interface. The requested property set is contained in the storage or stream object specified by pUnk. The value of the grfFlags parameter indicates whether pUnk specifies a storage or stream object. For example, if PROPSETFLAG_NONSIMPLE is set, then pUnk can be queried for an IStorage interface on a storage object.

In either case, this function calls pUnk->AddRef for the storage or stream object containing the property set. It is the responsibility of the caller to release the object when it is no longer needed.

This function is similar to the IPropertySetStorage::Open method. However, StgOpenPropStg adds the pUnk and grfFlags parameters, including the PROPSETFLAG_UNBUFFERED value for the grfFlags parameter. Use this function instead of the Open method if you have an IStorage interface that does not support the IPropertySetStorage interface, or if you want to use the PROPSETFLAG_UNBUFFERED value. See the PROPSETFLAG enumeration for more information on using PROPSETFLAG_UNBUFFERED.

The grfFlags parameter is a combination of values taken from the enumeration PROPSETFLAG. The new enumeration value PROPSETFLAG_UNBUFFERED is supported. See the PROPSETFLAG enumeration for more information on the use of this value.

Programming Information

Windows NT 4.0/SP2 or with IPROP.DLL
Win95 Yes; requires IPROP.DLL
Win32s No
Unicode Yes
Import Library IPROP.DLL
Header File IPROPIDL.H

QuickInfo

  Windows NT: Use version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in objidl.h.
  Import Library: Included as a resource in ole32.dll.

See Also

IPropertySetStorage, IPropertySetStorage-Standalone Implementation, IPropertyStorage, IPropertyStorage-Standalone Implementation, PROPSETFLAG, StgCreatePropStg, StgCreatePropSetStg