Raymun
asked on
CHtmlView::GetSource() Problem Retrieving Full Source
When I CHtmlView::Navigate2(..) to a particular Web page, a subsequent call to CHtmlView::GetSource(..) from CHtmlView::OnNavigateCompl ete2() does not retrieve the full HTML source code. Instead, it is cut short. That is, only some of the source is retrieved. For example, if I open up IE to the web page and View->Source, and the source is, say, 100kB, then calling CHtmlView::GetSource(..) after navigating to the same page retrieves something < 100kB.
Any ideas on how to get the full source? Thanks
Any ideas on how to get the full source? Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ASKER
OnDocumentComplete() did the trick. Thanks Dan
ASKER
When I CHtmlView::Navigate2(..) to a page with a big source file, a subsequent call to CHtmlView::GetSource(..) from CMyHtmlView::OnNavigateCom
I also tried overriding GetSource(..) to use IHTMLwhatever to get the source:
CMyHtmlView::GetSource(CSt
{
CComPtr<IDispatch> pDisp = GetHtmlDocument();
CComPtr<IHTMLDocument2> pDoc;
pDisp->QueryInterface(IID_
CComPtr<IHTMLElement> pBody;
pDoc->get_body(&pBody);
...
}
However, after the call to get_body(..), pBody is always NULL regardless of what page I've navigated to, even though both pDisp and pDoc are NOT NULL.
Another idea i tried was overriding CHtmlView::GetSource(..) and keeping everything the same except changing
hMemory = GlobalAlloc(GMEM_MOVEABLE,
to
hMemory = GlobalAlloc(GMEM_MOVEABLE,
and after testing different numbers, the returned source is still cut short.
I am running out of ideas. Please help.
DanRollins:
Thanks for the input. What two identical functions are you referring to? Anyway I will look into the CString and see what I can find. I wasn't familiar with OnDocumentComplete(..). According to Microsoft, the event is fired after finishing downloading a Web page. I thought CHtmlView::OnNavigateCompl
Thanks