StgCreatePropStg

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

HRESULT StgCreatePropStg(
  IUnknown* pUnk,       //Interface pointer for object containing 
                        // the new property set
  REFFMTID fmtid,       //Format identifier of the property set to 
                        // be created
  const CLSID* pclsid,  //Initial CLSID for the new property set
  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] Pointer to the IUnknown interface on the storage or stream object that stores the new property set.
fmtid
[in] Format identifier of the property set to be created.
pclsid
[in] Pointer to the initial CLSID for this property set. May be NULL, in which case pclsid is set to all zeroes.
grfFlags
[in] Values from the PROPSETFLAG enumeration that determine how the property set is created and opened.
dwReserved
[in] Reserved; must be zero.

ppPropStg
[out] Address of IPropertyStorage* pointer variable that receives the interface pointer to the new 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 created.
STG_E_ACCESSDENIED
The requested access to the property storage object has been denied.
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.
STG_E_MEDIUMFULL
The storage object could not be increased in size to hold the default property set.

Remarks

StgCreatePropStg creates and opens a new property set which supplies the system-provided, standalone implementation of the IPropertyStorage interface. The new 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::Create method. However, StgCreatePropStg adds the pUnk parameter and supports the PROPSETFLAG_UNBUFFERED value for the grfFlags parameter. Use this function instead of the Create 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 this PROPSETFLAG_UNBUFFERED.

The property set automatically contains code page and locale ID properties. These are set to the current system default and the current user default, respectively.

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, StgOpenPropStg, StgCreatePropSetStg