Export (0) Print
Expand All

IPropertySetStorage::Create method

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

Syntax


HRESULT Create(
  [in]   REFFMTID fmtid,
  [in]   const CLSID *pclsid,
  [in]   DWORD grfFlags,
  [in]   DWORD grfMode,
  [out]  IPropertyStorage **ppProgStg
);

Parameters

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:

S_OK

The property set was created.

STG_E_FILEALREADYEXISTS

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

STG_E_ACCESSDENIED

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

STG_E_INSUFFICIENTMEMORY

There is not enough memory to perform this operation.

STG_E_INVALIDFUNCTION

The specified combination of grfMode flags is not supported.

STG_E_REVERTED

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

STG_E_INVALIDPARAMETER

A parameter is invalid.

Remarks

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.

ValueMeaning
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.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps | Windows Store apps]

Minimum supported server

Windows 2000 Server [desktop apps | Windows Store apps]

Header

Propidl.h (include Objbase.h)

Library

Uuid.lib

DLL

Ole32.dll

IID

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

See also

Samples
StgCreatePropSetStg Sample
WriteRead Sample
IPropertySetStorage::Open
IPropertySetStorage
PROPSETFLAG Constants

 

 

Community Additions

ADD
Show:
© 2014 Microsoft