0

这是我在 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.
4

1 回答 1

1

你的第一个演员看起来很讨厌。我会得到非强制转换的文档类型(IHTMLDocument2 ?),然后对它执行查询接口到 IHTMLDocument3。

CComPtr<IHTMLDocument2> pDoc2 = m_webBrowser.get_Document();// assuming it returns IHTMLDocument2

CComPtr<IHTMLDocument3> pDoc3;
pDoc2->QueryInterface(&pDoc3);
于 2012-07-28T16:04:18.580 回答