Article #26729: How to load an HTML document from a stream into a TCppWebBrowser.
Question
How can I do the equivalent of LoadFromStream within a TWebBrowser (IE control)?
Answer
Assuming that your HTML document is contained within Memo1, the code snipped below should illustrate how to
load it from a stream into a TCppWebBrowser.
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;
}