Contents Index Topic Contents | ||
Previous Topic: IPropertyBag2::GetPropertyInfo Next Topic: IPropertyBag2::Read |
IPropertyBag2::LoadObject
HRESULT LoadObject( [in] LPCOLESTR pstrName, [in] DWORD dwHint, [in] IUnknown * pUnkObject, [in] IErrorLog * pErrLog);Causes the property bag to instruct a previously created and initialized property object to read its persistent properties.
- Returns one of the following values or any of the IPersist*::Read method return values:
S_OK The object successfully retrieved its properties. E_INVALIDARG One or more of the arguments is not valid.
- pstrName
- [in] Name of the property object.
- dwHint
- [in] Hint value that was retrieved using GetPropertyInfo. This argument is optional and must be zero if the hint is not known or used.
- pUnkObject
- [in] Address of the object's IUnknown interface. This argument cannot be NULL.
- pErrLog
- [in] Address of an IErrorLog interface in which the property bag stores any errors that occur during the load. This argument can be NULL; in that case, the caller is not interested in logging errors.
LoadObject allows the calling application to participate in the creation and initialization of a property object. When using the IPropertyBag interface, it is possible to load a property object using the IPropertyBag::Read method with VT_UNKNOWN. The IPropertyBag method does not, however, allow the property object to be initialized by the calling application before the property object reads its own persistent data. LoadObject allows the property object to be created and initialized by the calling application instead of having the property bag create and initialize it.
To use LoadObject, the property object's name and CLSID are retrieved using GetPropertyInfo. The property object is then created and initialized. LoadObject is then used in lieu of IPropertyBag2::Read to cause the property object to read its persistent data.
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.