代码
void __fastcall TForm1::CppWebBrowser1DocumentComplete(TObject *Sender,
LPDISPATCH pDisp, Variant *URL)
{
if(!CppWebBrowser1->Busy &&flag==1)
{
IHTMLDocument2 *document;
IHTMLElement *body;
BSTR source;
(void *)document=CppWebBrowser1->Document;
if (document == NULL) return;
if(SUCCEEDED(document->get_body(&body)))
{
if(SUCCEEDED(body->get_outerHTML(&source)))
{
ht=AnsiString(source);
ht=StringReplace(ht,"原来的","最新的"+Kucun,TReplaceFlags()<<rfReplaceAll) ;
body->put_innerHTML(WideString(ht)); //只添加body处,对<html>没有影响
}
}
document->Release();
body->Release();
}
flag=0; //
}
LPDISPATCH pDisp, Variant *URL)
{
if(!CppWebBrowser1->Busy &&flag==1)
{
IHTMLDocument2 *document;
IHTMLElement *body;
BSTR source;
(void *)document=CppWebBrowser1->Document;
if (document == NULL) return;
if(SUCCEEDED(document->get_body(&body)))
{
if(SUCCEEDED(body->get_outerHTML(&source)))
{
ht=AnsiString(source);
ht=StringReplace(ht,"原来的","最新的"+Kucun,TReplaceFlags()<<rfReplaceAll) ;
body->put_innerHTML(WideString(ht)); //只添加body处,对<html>没有影响
}
}
document->Release();
body->Release();
}
flag=0; //
}

浙公网安备 33010602011771号