This is the code I write in a OnBtnClick Function
CComPtr<IHTMLDocument3> pDoc3 = (IHTMLDocument3 *)m_webBrowser.get_Document();
CComPtr<IHTMLElement> pElem;
BSTR idTmp = CComBSTR(L"article_summary");
HRESULT hr = pDoc3->getElementById(idTmp, &pElem);
I’m trying to get the element which Id is “article_sumary”。。。but I got this
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.
That first cast you have looks nasty. I would get the non-casted document type (IHTMLDocument2 ?) and then perform a query interface on it to the the IHTMLDocument3.