Export (0) Print
Expand All

IPropertyBag2::LoadObject Method

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

Syntax


HRESULT LoadObject(
    LPCOLESTR pstrName,
    DWORD dwHint,
    IUnknown *pUnkObject,
    IErrorLog *pErrLog
);

Parameters

pstrName
[in] The address of the name of the property object.
dwHint
[in] 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] The address of the object's IUnknown interface. This argument cannot be NULL.
pErrLog
[in] 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.

Return Value

Returns one of the following values or any of the IPersist*::Read method error values.

S_OK The object successfully retrieved its properties.
E_INVALIDARG One or more of the arguments is not valid.

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.

Community Additions

ADD
Show:
© 2015 Microsoft