I could not find any example using IHTMLDocument3::attachEvent in C++. The function described in MSDN is also different from what Visual Studio describes:
MSDN: attachEvent(BSTR event, IDispatch *pDisp)
VS: attachEvent(BSTR event, IDispatch *pDisp, VARIANT_BOOL *pfResult)
Does anyone have an example in C++?
Description is accurate: in C++ you have actually returned value
pfResultas an[out]argument, and the method returnsHRESULTto indicate success or failure (failure is translated to exception on script side).pDispneeds to be implementation ofIDispatchbeing able to handleIDispatch::Invokewith dispid of zero (DISPID_VALUE).