IWebBrowser2::PutProperty Method

Associates a user-defined name/value pair with the object.

Syntax

HRESULT PutProperty(
    BSTR bstrProperty,
    VARIANT vtValue
);

Parameters

  • bstrProperty
    [in] A BSTR that specifies the exact name of the property to set.
  • vtValue
    [in] A VARIANT that specifies the new value of the property.

Return Value

Possible return values include, but are not limited to, those in the following table.

S_OK The operation was successful.
E_INVALIDARG One or more parameters are invalid.
E_OUTOFMEMORY There was not enough memory to complete the operation.
E_ACCESSDENIED The operation cannot be performed on frames within a WebBrowser control.

Remarks

This method can be used to store any property value or automation-compatible object reference. There are no pre-defined property values.

The property name specified in bstrProperty is case-sensitive.

If the object passed in vtValue implements the IObjectWithSite interface and the browser object is set as the site, SetSite( NULL) is called when the property value is discarded. If the object implements the IDiscardableBrowserProperty interface, the browser automatically releases the object if it is not accessed for 10 minutes. For more information, see Discardable Properties for Your Web Pages in Internet Explorer 4.0 and 5.0.

The WebBrowser object delegates this method to the top-level frame. If no frame exists, it returns E_FAIL.

See Also

IWebBrowser2::GetProperty, DWebBrowserEvents2::PropertyChange