PSPropertyBag_ReadType function (propsys.h)

Reads the type of data value of a property that is stored in a property bag.

Syntax

PSSTDAPI PSPropertyBag_ReadType(
  [in]  IPropertyBag *propBag,
  [in]  LPCWSTR      propName,
  [out] VARIANT      *var,
  [out] VARTYPE      type
);

Parameters

[in] propBag

Type: IPropertyBag*

A pointer to an IPropertyBag object, that represents the property bag in which the property is stored.

[in] propName

Type: LPCWSTR

A pointer to a null-terminated property name string.

[out] var

Type: VARIANT*

Returns on successful function completion a pointer to a VARIANT data type that contains the property value.

[out] type

Type: VARTYPE*

If type is VT_EMPTY, this function reads the VARIANT of the property in the IPropertyBag propBag parameter. If type is not VT_EMPTY and not the same as the VARIANT read, then this function attempts to convert the VARIANT read to the VARTYPE defined by type parameter before returning.

Return value

Type: HRESULT

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

IPropertyBag and IPersistPropertyBag optimize Save As Text functionality. IPropertyBag and IPropertyBag2 provide an object with a property bag in which the object can save its properties persistently. IPropertyBag2 allows the object to obtain type information for each property: IPropertyBag2::Read causes one or more properties to be read from the property bag, and IPropertyBag2::Write causes one or more properties to be saved into the property bag.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header propsys.h
Library Propsys.lib
DLL Propsys.dll (version 6.0 or later)

See also

PSPropertyBag_Delete