Share via

PutProperty method

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


Long retVal = object.PutProperty(sProperty, vValue);


  • sProperty [in]
    Type: BSTR

    A BSTR that specifies the exact name of the property to set.

  • vValue [in]
    Type: Variant

    A VARIANT that specifies the new value of the property.


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