TCppWebBrowser 自动翻页老是出错,,怎么改啊
bool __fastcall ExecutePage(TCppWebBrowser *p, String strFuncName, int page,String strLang=L"JavaScript")
{
bool bRet = false;
if(p==NULL) return bRet;
IHTMLDocument2 *spDoc = NULL;
HRESULT hr = p->Document->QueryInterface( ::IID_IHTMLDocument2, (void **)&spDoc);
if (SUCCEEDED(hr))
{
strFuncName =strFuncName+"("+IntToStr(page)+");";
if (spDoc)
{
IHTMLWindow2 *pWin;
HRESULT hr = spDoc->get_parentWindow(&pWin);
//-----------总是在这里出错,,该怎么弄啊?
if (SUCCEEDED(hr))
{
VARIANT vRet;
hr = pWin->execScript(strFuncName.w_str(), strLang.w_str(), &vRet);
pWin->Release();
bRet = SUCCEEDED(hr);
}
}
}
return bRet;
}
bool __fastcall ExecutePage(TCppWebBrowser *p, String strFuncName, int page,String strLang=L"JavaScript")
{
while (p->Busy)
Application->ProcessMessages();
...
}