为什么我用fireEvent触发button的onclick事件打开页面,没有效果呢?
CComQIPtr<IHTMLDocument2> spDoc2;
CComQIPtr<IDispatch> spDoc2Disp;
spEle->get_document(&spDoc2Disp);
if(spDoc2Disp == NULL)
return 1;
spDoc2 = spDoc2Disp;
CComQIPtr<IHTMLDocument4> spDoc4 = spDoc2;
if(spDoc4 == NULL)
return 1;
CComPtr<IHTMLEventObj> spEvent;
CComVariant var;
spDoc4->createEventObject(&var, &spEvent);
CComQIPtr<IHTMLEventObj2> spEvent2(spEvent);
CComBSTR eventName = "onclick";
spEvent2->put_type(eventName);
CComQIPtr<IHTMLElement3, &IID_IHTMLElement3> spEle3(spEle);
VARIANT_BOOL varbResult;
CComVariant varEvent = spEvent;
hr = spEle3->fireEvent(eventName, &varEvent, &varbResult);