求解下面的代码
IHTMLDocument2* CMy2Dlg::GetIeDoc(HWND HWIe)
{
HMODULE hModule=::LoadLibrary("OLLEACC.h");
CComPtr<IHTMLDocument>psDoc=NULL;
IHTMLDocument2 *iHtmlDocument2=NULL;
//IHTMLDocument *iHtmlDocument=NULL;
UINT Msg=::RegisterWindowMessage(_T("WM_HTML_GETOBJECT"));
HRESULT hRes=NULL;
UINT i=::SendMessageTimeout(HWIe,Msg,0L,0L,SMTO_ABORTIFHUNG,10000,(unsigned long*)hRes);
if(i==0)
{
MessageBox("程序出错");
return NULL;
}
LPFNOBJECTFROMLRESULT lpObjectFromLresult=(LPFNOBJECTFROMLRESULT)::GetProcAddress(hModule,"ObjectFromLresult");
HRESULT H=lpObjectFromLresult(hRes,IID_IHTMLDocument2,0,(void**)&iHtmlDocument2);
if(SUCCEEDED(H))
{
CComPtr<IDispatch>dispatch=NULL;
CComQIPtr<IHTMLWindow2>spWin;
psDoc->get_Script(&dispatch);\\这是在干嘛?如果是获得脚本引擎那下一步又是在干嘛?
spWin=psDoc;
spWin->get_document(&iHtmlDocument2);
}
else
{
return NULL;
}
return iHtmlDocument2;
}
页:
[1]