IPropertySetStorage::Create method

The Create method creates and opens a new property set in the property set storage object.


  [in]  REFFMTID         fmtid,
  [in]  const CLSID      *pclsid,
  [in]  DWORD            grfFlags,
  [in]  DWORD            grfMode,
  [out] IPropertyStorage **ppProgStg


fmtid [in]

The FMTID of the property set to be created. For information about FMTIDs that are well-known and predefined in the Platform SDK, see Predefined Property Set Format Identifiers.

pclsid [in]

A pointer to the initial class identifier CLSID for this property set. May be NULL, in which case it is set to all zeroes. The CLSID is the CLSID of a class that displays and/or provides programmatic access to the property values. If there is no such class, it is recommended that the FMTID be used.

grfFlags [in]

The values from PROPSETFLAG Constants.

grfMode [in]

An access mode in which the newly created property set is to be opened, taken from certain values of STGM_Constants, as described in the following Remarks section.

ppProgStg [out]

A pointer to the output variable that receives the IPropertyStorage interface pointer.

Return value

This method supports the standard return value E_UNEXPECTED, as well as the following:


The property set was created.


A property set of the indicated name already exists, and STGM_CREATE was not specified.


The requested access to the property storage object has been denied.


There is not enough memory to perform this operation.


The specified combination of grfMode flags is not supported.


The storage object has been invalidated by a revert operation above it in the transaction tree.


A parameter is invalid.


IPropertySetStorage::Create creates and opens a new property set subobject (supporting the IPropertyStorage interface) contained in this property set storage object. The property set automatically contains code page and locale ID properties. These are set to the Unicode and the current user default, respectively.

The grfFlags parameter is a combination of values taken from PROPSETFLAG Constants. If the PROPSETFLAG_ANSI value from this enumeration is used, the code page is set to the current system default, rather than Unicode.

The grfMode parameter specifies the access mode in which the newly created set is to be opened. Values for this parameter are as in the grfMode parameter to IPropertySetStorage::Open, with the addition of the values listed in the following table.

STGM_FAILIFTHEREIf another property set with the specified fmtid parameter exists, the call fails. This is the default action; that is, unless STGM_CREATE is specified, STGM_FAILIFTHERE is implied.
STGM_CREATEIf another property set with the specified fmtid parameter already exists, it is removed and replaced with this new one.


The created property set is simple by default, but the caller may request a nonsimple property set by specifying the PROPSETFLAG_NONSIMPLE value in the grfFlags parameter. For more information about simple and nonsimple property sets, see Storage and Stream Objects for a Property Set.

This method is subject to the constraints of the underlying IStorage::CreateStream (for simple property sets) or IStorage::CreateStorage (for nonsimple property sets). For example, when using the IPropertySetStorage-Compound File Implementation, specify STGM_SHARE_EXCLUSIVE in the grfMode parameter to IPropertySetStorage::Create. Conversely, if using the IPropertySetStorage-Stand-alone Implementation, IPropertySetStorage::Create is subject to constraints that apply to the caller-specified IStorage.


Minimum supported client

Windows 2000 Professional [desktop apps | UWP apps]

Minimum supported server

Windows 2000 Server [desktop apps | UWP apps]


Propidl.h (include Objbase.h)






IID_IPropertySetStorage is defined as 0000013A-0000-0000-C000-000000000046

See also

StgCreatePropSetStg Sample
WriteRead Sample