这是我在OnBtnClick函数中编写的代码
CComPtr<IHTMLDocument3> pDoc3 = (IHTMLDocument3 *)m_webBrowser.get_Document();
CComPtr<IHTMLElement> pElem;
BSTR idTmp = CComBSTR(L"article_summary");
HRESULT hr = pDoc3->getElementById(idTmp, &pElem);
我正在尝试获取Id为“article_sumary”的元素......但我得到了这个
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function
call. This is usually a result of calling a function declared with one calling
convention with a function pointer declared with a different calling convention.
答案 0 :(得分:1)
第一次演员你看起来很讨厌。我会得到非转换文档类型(IHTMLDocument2?),然后对它执行查询接口到IHTMLDocument3。
CComPtr<IHTMLDocument2> pDoc2 = m_webBrowser.get_Document();// assuming it returns IHTMLDocument2
CComPtr<IHTMLDocument3> pDoc3;
pDoc2->QueryInterface(&pDoc3);