SHPropertyBag_WriteStr

This function asks a property bag to write a string as the value of a named property.

Declaration

HRESULT
SHPropertyBag_WriteStr (
    IPropertyBag *ppb,
    LPCWSTR pszPropName,
    LPCWSTR pszValue);

Parameters

The ppb argument provides the address of an IPropertyBag interface.

The pszPropName argument provides the address of a null-terminated Unicode string that names the property.

The pszValue argument provides the address of the string to write as the property value.

Return Value

The function returns zero for success, else an error code.

Behaviour

If either of the ppb and pszPropName arguments are NULL, the function fails, with E_INVALIDARG as the error code. If the function cannot get memory for a temporary copy of the given string to use as a VT_BSTR type for the property bag’s Write method, including if pszValue is NULL, then the function fails, with E_OUTOFMEMORY as the error code. If the Write method fails, so does the function.

Availability

The SHPropertyBag_WriteStr function is exported from SHLWAPI as ordinal 495 in version 6.00.

Though this function dates from 2001, it was still not documented by Microsoft in the MSDN Library at least as late as the CD edition dated January 2004.