Click here to Skip to main content
15,918,624 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:
Hi,
I am developing an IE toolbar in C Sharp that accesses the html source of page displayed in IE and process it. I'm relying on the ondocumentcomplete event handler. When it is fired, the html source is taken. But I have a trouble with pages having frames since ondocumentcomplete is fired for each frame, the last being the outer frame, the window. In order to tackle this I did like this -
C#
public void OnDocumentComplete(object pDisp, ref object URL)
{
  if (pDisp.Equals(Explorer.IWebBrowser_Parent))
    {
         // check for frames n get the source of all
    }
  else
        // ignore
 }

Like this I was able to get the last ondocumentcomplete event and then get the source of all the frames. But the problem is for certain pages that have frame or iframe, ondocumentcomplete is not fired for the window. so the above code would not process any such e.g - http://www.w3schools.com/html/tryit.asp?filename=tryhtml_intro[^] fires an ondocumplete for that url, however clicking on 'edit and click me' button though reloads the frame, doesnt fire ondocumentcomplete for the window. How to work around this?

Thanks,
Arun
Posted
Updated 30-Apr-11 6:39am
v2

Have a look at this link. It also has some very good example source:
http://happynomad121.blogspot.com/2009/09/listening-to-html-events-from-bho.html[^]

Good luck!
 
Share this answer
 
Thanks for the response Nijboer. I got the solution. Its mentioned clearly in http://support.microsoft.com/kb/q180366/[^]

Asks us to compare the first navigatecomplete2 fired with each documentcomplete.
 
Share this answer
 
The URL is https://support.microsoft.com/en-us/kb/180366
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900