Calling C # BHO Methods from Javascript In Internet Explorer 10 (Version Preview)

I am trying to develop BHO to preview IE version 10. BHO should be able to enable javascript to call a C # function.

I followed the instructions below:

Calling BHO C # Methods from Javascript

These instructions work fine in IE 9.

Unfortunately, I found that they only work for the first tab created in IE 10. The second and subsequent tabs do not display the BHO interface for Javascript. Sometimes new tabs work, but most of the time they don't work. Moreover, he fails. I assume this has something to do with the process model, but then again, it works fine in IE 9 (which has the same process model).

Here is a specific piece of code that I am using:

private void InstallJSObject(IHTMLWindow2 window) { // Install our javascript object IExpando windowEx = (IExpando)window; PropertyInfo property = windowEx.GetProperty("myBHO", System.Reflection.BindingFlags.IgnoreCase); if (property == null) { property = windowEx.AddProperty("myBHO"); } property.SetValue(windowEx, this, null); } 

Before publishing, I investigated the following: http://bit.ly/R9qldf

+7
source share
1 answer
 var myATL = new ActiveXObject("MySampleATL.MyClass"); if (myATL.IsBHOInstalled) alert (myATL. SayHelloFromBHO()); else alert ("BHO isn't installed now !"); window.external.AddFavorite(<url>, "text"); 

Extracted from here .

The blog dates back to April'07, perhaps this is what you were looking for.

0
source

All Articles