Invoke htmlelement event sometome failed, why?



I want to fire htmlelement event with the following code fragment,
sometime is work ,and sometime it failed.
.......
CComPtr < IHTMLElement > pEle; // I have got it .
CComVariant vClickevent;
vClickevent=NULL;
pEle->get_onclick(&vClickevent); // get vClientvent ok!
if (V_VT(&vClickevent) == VT_DISPATCH && V_DISPATCH(&vClickevent))
{
IDispatch* pHandler = V_DISPATCH(&vClickevent); //get
handle ok!
DISPPARAMS params = {0};
HRESULT hresult;
hresult = pHandler->Invoke(DISPID_VALUE, IID_NULL,
LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, 0, 0, 0);
}

sometime the result hresult =-2147418113 .

wait for succor.
tks

victor

.



Relevant Pages

  • Invoke htmlelement event sometome failed, why?
    ... I want to fire htmlelement event with the following code fragment, ... CComVariant vClickevent; ... DISPPARAMS params =; ... HRESULT hresult; ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • followup
    ... Here is the code fragment, maybe it will help determine what I am doing wrong. ... the hresult of the draw call returns invalid call. ...
    (microsoft.public.win32.programmer.directx.graphics)