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


SHPropertyBag_WriteGUID (
    IPropertyBag *ppb,
    LPCWSTR pszPropName,
    LPCGUID pGuid);


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 pGuid argument provides the new value as a GUID.

Return Value

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


If any of the ppb, pszPropName and pGuid arguments are NULL, the function fails, with E_INVALIDARG as the error code. The function translates the given GUID to the usual string representation in braces. If the function cannot write this string as the property value (using SHPropertyBag_WriteStr), it fails.


The SHPropertyBag_WriteGUID function is exported from SHLWAPI as ordinal 506 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.