LoadObject method

Causes the property bag to instruct a property object that was previously created and initialized to read its persistent properties.

Syntax

HRESULT retVal = object.LoadObject(pstrName, dwHint, pUnkObject, pErrLog);

Parameters

  • pstrName [in]
    Type: LPCOLESTR

    The address of the name of the property object.

  • dwHint [in]
    Type: DWORD

    An integer value that was retrieved by using IPropertyBag2::GetPropertyInfo. This argument is optional and must be zero, if the value is not known or used.

  • pUnkObject [in]
    Type: IUnknown

    The address of the object's IUnknown interface. This argument cannot be NULL.

  • pErrLog [in]
    Type: IErrorLog

    The address of an IErrorlog interface in which the property bag stores any errors that occur during the load. This argument can be NULL; in which case, the caller does not receive logging errors.

Remarks

The IPropertyBag2::LoadObject method enables the calling application to participate in the creation and initialization of a property object. When the IPropertyBag interface is used, a property object can be loaded by using the IPropertyBag::Read method with VT_UNKNOWN. The IPropertyBag interface does not allow the property object to be initialized by the calling application before the property object reads its own persistent data. IPropertyBag2::LoadObject allows the property object to be created and initialized by the calling application, instead of using the property bag to create and initialize the property object.

To use IPropertyBag2::LoadObject, get the property object's name and CLSID by using IPropertyBag2::GetPropertyInfo. The property object is created and initialized. IPropertyBag2::LoadObject is used instead of IPropertyBag2::Read to cause the property object to read its persistent data.