转贴CSDN中的回复,但不完全,
回复人: bilyx(无言) (2001-9-18 11:08:38) 得0分
下面的代码基本上可以完成你所要求的功能
IHTMLDocument2* pDoc;
IHTMLElement* pEl;
BSTR Html;
HRESULT hr;
hr = CppWebBrowser1->Document->QueryInterface(IID_IHTMLDocument2, (void**)&pDoc);
if (hr == S_OK)
{
hr = pDoc->get_body(&pEl);
if(hr == S_OK)
{
pEl->get_outerText(&Html);
Memo1->Text = AnsiString(Html);
}
}
不要忘了 #include "mshtml.h".
回复人: HEROIN(HEROIN) (2001-9-19 17:51:53) 得0分
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TMemoryStream *stm = new TMemoryStream();
Memo1->Lines->SaveToStream(stm);
IPersistStreamInit *psi;
stm->Seek(0,0);
//if you pass soOwned instead, the stream will be freed for you
TStreamAdapter *sa = new TStreamAdapter(stm,soReference);
if (SUCCEEDED(wb->Document->QueryInterface(IID_IPersistStreamInit,(void **)&psi)))
psi->Load(*sa);
delete stm;
}
这里难道不如CSDN吗?