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


SHPropertyBag_WriteInt (
    IPropertyBag *ppb,
    LPCWSTR pszPropName,
    INT iValue);


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 iValue argument provides the new value as an integer.

Return Value

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


If either of the ppb and pszPropName arguments are NULL, the function fails, with E_INVALIDARG as the error code. If the property bag’s Write method cannot write the integer as a VT_I4 type, the function fails.


The SHPropertyBag_WriteInt function is exported from SHLWAPI as ordinal 530 in version 6.00. It is (presently) implemented as an alias of SHPropertyBag_WriteLONG.

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.