Click to return to the Component Development home page    
IPropertyBag2::GetPropert...     IPropertyBag2::Read Metho...     IPropertyBag2 Interface    
Web Workshop  |  Component Development

IPropertyBag2::LoadObject Method


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

Syntax

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

Parameters

pstrName
[in] Address of the name of the property object.
dwHint
[in] Integer value that was retrieved using GetPropertyInfo. This argument is optional and must be zero if the value 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 does not receive logging errors.

Return Value

Returns one of the following values:

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

Any of the IPersist*::Read method error values may also be returned.

Remarks

The LoadObject method 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 interface 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 instead of IPropertyBag2::Read to cause the property object to read its persistent data.



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.