PSPropertyBag_ReadStrAlloc function (propsys.h)

Reads a string data value from a property in a property bag and allocates memory for the string that is read.

Syntax

PSSTDAPI PSPropertyBag_ReadStrAlloc(
  [in]  IPropertyBag *propBag,
  [in]  LPCWSTR      propName,
  [out] PWSTR        *value
);

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] value

Type: PWSTR*

When this function returns, contains a pointer to a string data value from a property in a property bag and allocates memory for the string that is read. The caller of the PSPropertyBag_ReadStrAlloc function needs to call a CoTaskMemFree function on this parameter.

Return value

Type: HRESULT

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

Remarks

The property bag property function API converts between window types and the VARIANT type that is used to express values in a property bag. Doing so eases property bag usage, simplifies applications, and avoids common coding errors.

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)