PSSetPropertyValue function

Sets the value of a property in a property store.

Syntax


HRESULT PSSetPropertyValue(
  _In_  IPropertyStore *pps,
  _In_  IPropertyDescription *ppd,
  _In_  REFPROPVARIANT propvar
);

Parameters

pps [in]

Type: IPropertyStore*

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

ppd [in]

Type: IPropertyDescription*

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

propvar [in]

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

Minimum supported client

Windows XP with SP2, Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 with SP1 [desktop apps only]

Redistributable

Windows Desktop Search (WDS) 3.0

Header

Propsys.h

Library

Propsys.lib

DLL

Propsys.dll (version 6.0 or later)

See also

PSGetPropertyValue
IPropertyStore::Commit

 

 

Community Additions

ADD
Show:
© 2014 Microsoft