Click to return to the Reusing Browser Technology home page    
IHTMLDocument3 Interface     IHTMLDocument3::createDoc...     IHTMLDocument3 Interface    
Web Workshop  |  Reusing Browser Technology

IHTMLDocument3::attachEvent Method


Binds the specified function to an event, so that the function gets called whenever the event fires on the object.

Syntax

HRESULT attachEvent(
    BSTR event, 
    IDispatch *pDisp,
    VARIANT_BOOL *pfResult
);

Parameters

event
String (BSTR) that specifies the name of the event.
pDisp
Address of an IDispatch interface that returns an object to be called whenever event fires.
pfResult
Address of a VARIANT Boolean structure that returns VARIANT_TRUE if successful, or VARIANT_FALSE otherwise.

Return Value

Returns S_OK if the function was bound successfully, or an error code otherwise.

Remarks

When event fires on the object, the object's event handler is called first before the specified function, pDisp. If multiple functions are attached to the same event on the same object, the pDisp(s) will be called in a random order, immediately after the object's event handler is called.

See Also

detachEvent



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.