Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

process a page with Tcppwebbrowser

Status
Not open for further replies.

TNor

Programmer
Aug 1, 2002
1
NL
i have an application with a cppwebbrowser in it, but now i would like to have to source of the page that the browser is displaying at that moment. How can i do this?
or if not possible, what is a possible way to do it.
 
IHTMLDocument2 *htm = NULL; // #include <mshtml.h>

if(TCppWebBrowser->Document && SUCCEEDED(TCppWebBrowser->Document->QueryInterface(IID_IHTMLDocument2,(LPVOID*)&htm))){
IPersistStreamInit *spPsi = NULL; // ocidl.h
if(SUCCEEDED(htm->QueryInterface(IID_IPersistStreamInit, (LPVOID*)&spPsi)) && spPsi){
IStream *spStream = NULL; // objidl.h
OleCheck(CreateStreamOnHGlobal(NULL, true, &spStream));
if(spStream)
{
__int64 nSize = 0;
STATSTG ss;
LARGE_INTEGER nMove;
nMove.QuadPart = 0;
OleCheck(spPsi->Save(spStream, true));
OleCheck(spStream->Seek(nMove, STREAM_SEEK_SET, (ULARGE_INTEGER*)&nSize));
OleCheck(spStream->Stat(&ss, STATFLAG_NONAME));
nSize = ss.cbSize.QuadPart;

Source.SetLength(nSize);
OleCheck(spStream->Read((void *)Source.data(), nSize, (ULONG*)&nSize));
OleCheck(spStream->Release());
}

spPsi->Release();
}
htm->Release();
}

Memo1->Add->Lines->Source;

&quot;Source&quot; is the String with the html source in it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top