- UID
- 292
- 精华
- 积分
- 23
- 威望
- 点
- 宅币
- 个
- 贡献
- 次
- 宅之契约
- 份
- 最后登录
- 1970-1-1
- 在线时间
- 小时
|
- 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;
- [color=Red][/color]psDoc->get_Script(&dispatch);\\这是在干嘛?如果是获得脚本引擎那下一步又是在干嘛?
- [color=Red][/color]spWin=psDoc;
- spWin->get_document(&iHtmlDocument2);
- }
- else
- {
- return NULL;
- }
- return iHtmlDocument2;
- }
复制代码 |
|