expression cannot be evaluated 报错 CWebPage
expression cannot be evaluated 出错 CWebPage
//view
void CMailView::CallJSFuns(const CString strName, const CString strParam)
//调用脚本函数
{
CWebPage web;
web.SetDocument(m_webBrowser.GetDocument());
web.CallJScript(strName,strParam);
}
//不知道哪儿错了
//CWebpage
bool CWebPage::SetDocument(IDispatch* pDisp)
{
CHECK_POINTER(pDisp); //提示这句出现expression cannot be evaluated
m_spDoc=NULL;
CComPtr<IDispatch> spDisp = pDisp;
HRESULT hr = spDisp->QueryInterface(IID_IHTMLDocument2,(void**)&m_spDoc);
if(FAILED(hr))
{
ShowError("Failed to get HTML document COM object");
return false;
}
return true;
}
------解决方案--------------------
m_webBrowser.GetDocument()返回IDispatch* pDisp ?
//view
void CMailView::CallJSFuns(const CString strName, const CString strParam)
//调用脚本函数
{
CWebPage web;
web.SetDocument(m_webBrowser.GetDocument());
web.CallJScript(strName,strParam);
}
//不知道哪儿错了
//CWebpage
bool CWebPage::SetDocument(IDispatch* pDisp)
{
CHECK_POINTER(pDisp); //提示这句出现expression cannot be evaluated
m_spDoc=NULL;
CComPtr<IDispatch> spDisp = pDisp;
HRESULT hr = spDisp->QueryInterface(IID_IHTMLDocument2,(void**)&m_spDoc);
if(FAILED(hr))
{
ShowError("Failed to get HTML document COM object");
return false;
}
return true;
}
------解决方案--------------------
m_webBrowser.GetDocument()返回IDispatch* pDisp ?