c# - BHO only working in first IE window or tab open -


I use BHO by using C # How can I write and read and I can register it properly and run it, but it works just fine when the tab in the first window is open to me.

I know that aspects of this are being triggered in every new window, but do not "stick" changes or apply if they are affecting DOM, for example , I load a page that shows some text at the top of the page, it is always in the first tab, but all else can be disappeared first or not.

I am using C # 4 on Win7x64 using IE7. Protected mode does not affect this way or the other.

My code is just that what is happening here according to the tutorial, so nothing fancy.

  Namespace IEExtention   

{[Prudent (true), guid ("e8483cfd-d208-45f7-837c-3cdca573d84a"), Class Interface (ClassInterface Type .None)]

  public class BSH: IObjectWithSite {Private WebBrowser webBrowser; For private static reading, only ILog log = LogManager.GetLogger (System.Reflection.MethodBase.GetCurrentMethod (. Declaration declareType); Private object mySite; Public Entity Sitesite (Object Site) {If (Site! = Null) {mySite = site; WebBooger = (WebBozer) site; WebBrowser.DocumentComplete + = New DWebBrowserEvents2_DocumentCompleteEventHandler (this.OnDocumentComplete); } And {webBrowser.DocumentComplete - = new DWebBrowserEvents2_DocumentCompleteEventHandler (this.OnDocumentComplete); webBrowser = null; } Return 0; } Public at GetSite (Referred Guide Guide, Out Intuit PPVSite) {IntPtr punk = Marshal.GetIUnknownForObject (webBrowser); Int hr = martial.quick interface (punk, referee good, ppvite out); Marshal.Release (Punk); Returns HR; } Public Zero OnDocumentComplete (Object Pdk, RefUff URL) {log. Debug ("Test"); If (pdisp! = MySite) {return; } HTMLDocument Document = (HTMLDocument) this.webBrowser.Document; document.title = "hello, stack overflow!"; {IHTMLDOMNode Greetings = document.createTextNode ("Hi there!"); IHTMLDOMNode body = document.body IHTMLDOMNode; Body.insertBefore (Greetings, body.firstChild); } Hold (exception e) {// Hello !! }}   

I was stumped for a few days, as if document.title is not always changed.

I will be able to work this thread by threading my bho and sleeping for about half a second Was there. The interesting thing is that I need to reach out to about 1.5 seconds for external links (to say anything coming from Outlook) and get everything to display.

I'm not sure that this is the best way to do it but it is only working on the first tab in the solution to my problem.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -