PSSetPropertyValue function (propsys.h)

Sets the value of a property in a property store.

Syntax

PSSTDAPI PSSetPropertyValue(
  [in] IPropertyStore       *pps,
  [in] IPropertyDescription *ppd,
  [in] REFPROPVARIANT       propvar
);

Parameters

[in] pps

Type: IPropertyStore*

Pointer to an instance of the IPropertyStore interface, which represents the property store that contains the property.

[in] ppd

Type: IPropertyDescription*

Pointer to an instance of the IPropertyDescription interface, which identifies the individual property.

[in] propvar

Type: REFPROPVARIANT

Reference to a PROPVARIANT structure that contains the new value.

Return value

Type: HRESULT

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

Remarks

This helper function is used to write a property value to a store. If the calling code already has a PROPERTYKEY structure, it might be simpler to call IPropertyStore::SetValue directly.

Examples

The following example, to be included as part of a larger program, demonstrates how to use PSSetPropertyValue.

// IPropertyDescription *pPropDesc;
// IPropertyStore *pStore;
// PROPVARIANT propvar;
// Assume the variables pStore, pPropDesc, and propvar are initialized and valid.

HRESULT hr = PSSetPropertyValue(pStore, pPropDesc, propvar);

if (SUCCEEDED(hr))
{
    // The value has been written to the store but has not been committed yet.
}

Requirements

Requirement Value
Minimum supported client Windows XP with SP2, Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 with SP1 [desktop apps only]
Target Platform Windows
Header propsys.h
Library Propsys.lib
DLL Propsys.dll (version 6.0 or later)
Redistributable Windows Desktop Search (WDS) 3.0

See also

IPropertyStore::Commit

PSGetPropertyValue