Browser Helper Object in VB.NET

J

Joe Johnston

I need a Browser Helper object written in VB.NET Please
point me at a good example.

Joe
MCPx3

~ Hoping this MSDN ng three day turnaround is true.

Additional info:
What is a BHO? In its simplest form, a BHO is a COM in-
process server registered under a certain registry's key.
Upon startup, Internet Explorer looks up that key and
loads all the objects whose CLSID is stored there. The
browser initializes the object and asks it for a certain
interface. If that interface is found, Internet Explorer
uses the methods provided to pass its IUnknown pointer
down to the helper object.
 
G

Guest

Well, another microsoft imbellishment!!! No answer in 7
(seven) ... I thought following excerpt might hold
water; " Unlimited free support? Yes! Available now to
MSDN subscribers, MSDN managed newsgroups! In over 200
developer newsgroups, Microsoft will assure that you
receive a response to your posts within 72 hours! To use
this free service now, go to MSDN managed newsgroups. "
But, this is obviously not true. :(
I made my alias, I waited a few days posted as
directed and nothing, the big goose egg. Nice job. WELL
worth the money for the Cert partner/Univ MSDN
membership. NOT!

Way to be accountable MS,
Joe Johnston
 
J

John Eikanger

Hi, Joe

I checked our records of no-spam alias requests for the last 2 weeks and
found no reference to either the last name Johnston or the alias
(e-mail address removed). Looks like we may have had a tool problem. I apologize
for the inconvenience. The easiest way to handle this would be to either
reregister or send your registration information to
"(e-mail address removed)", removing "NOSPAM." from the email address.
Please select a no-spam alias other than (e-mail address removed), since that alias
is already in use by multiple people in the newsgroups.

I also found posts on November 6 and 7 that were apparently from you
concerning
the creation of a Browser Helper Object, both of which received a response
from Herfried. If these were indeed your posts, please get back to us with
confirmation and I will get someone on the problem right away.

Thank you for choosing the MSDN Managed Newsgroups,

John Eikanger
Microsoft Developer Support

This posting is provided “AS IS” with no warranties, and confers no rights.
--------------------
| Content-Class: urn:content-classes:message
| From: <[email protected]>
| Subject: Browser Helper Object in VB.NET
| Date: Sun, 16 Nov 2003 23:56:38 -0800
| Lines: 40

| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| Well, another microsoft imbellishment!!! No answer in 7
| (seven) ... I thought following excerpt might hold
| water; " Unlimited free support? Yes! Available now to
| MSDN subscribers, MSDN managed newsgroups! In over 200
| developer newsgroups, Microsoft will assure that you
| receive a response to your posts within 72 hours! To use
| this free service now, go to MSDN managed newsgroups. "
| But, this is obviously not true. :(
| I made my alias, I waited a few days posted as
| directed and nothing, the big goose egg. Nice job. WELL
| worth the money for the Cert partner/Univ MSDN
| membership. NOT!
|
| Way to be accountable MS,
| Joe Johnston
|
|
| >-----Original Message-----
| >I need a Browser Helper object written in VB.NET Please
| >point me at a good example.
| >
| >Joe
| >MCPx3
| >
| >~ Hoping this MSDN ng three day turnaround is true.
| >
| >Additional info:
| >What is a BHO? In its simplest form, a BHO is a COM in-
| >process server registered under a certain registry's
| key.
| >Upon startup, Internet Explorer looks up that key and
| >loads all the objects whose CLSID is stored there. The
| >browser initializes the object and asks it for a certain
| >interface. If that interface is found, Internet Explorer
| >uses the methods provided to pass its IUnknown pointer
| >down to the helper object.
| >
| >
| >.
| >
|
 
J

John Eikanger

Hi, Joe

If this isn't what you need, please respond with more details and I will
get a specialist on it:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwebgen/ht
ml/bho.asp

Thank you for choosing the MSDN Managed Newsgroups,

John Eikanger
Microsoft Developer Support

This posting is provided “AS IS” with no warranties, and confers no rights.
--------------------
| Content-Class: urn:content-classes:message
| From: "Joe Johnston" <[email protected]>
| Sender: "Joe Johnston" <[email protected]>
| Subject: Browser Helper Object in VB.NET
| Date: Mon, 10 Nov 2003 13:08:20 -0800
| Lines: 19
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcOnzsS0Rka85WzoQZy71nQzYYxrcQ==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Newsgroups: microsoft.public.dotnet.languages.vb
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:155670
| NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| I need a Browser Helper object written in VB.NET Please
| point me at a good example.
|
| Joe
| MCPx3
|
| ~ Hoping this MSDN ng three day turnaround is true.
|
| Additional info:
| What is a BHO? In its simplest form, a BHO is a COM in-
| process server registered under a certain registry's key.
| Upon startup, Internet Explorer looks up that key and
| loads all the objects whose CLSID is stored there. The
| browser initializes the object and asks it for a certain
| interface. If that interface is found, Internet Explorer
| uses the methods provided to pass its IUnknown pointer
| down to the helper object.
|
|
|
 
G

Guest

Hi John, This is super cool, except its in C#. I need it to be in VB.NET.
If I could see how to get to the browser events in VB I would be off and
running. But for now I'm in the hurt locker. :(

I am looking forward to your continued support to resolve an issue which is
clearly mine. :) <- This last bit was for ToddT :D Not everyone is a
pretentious rearend 100% of the time. I limit it to 5-15% ;)

Seriously though John, I appreciate for your very attentive attitude and
help thus far,
Joe Johnston
 
J

John Eikanger

Hi, Joe

VB.Net it is. I sent you another C# sample via email. It may give you
some help once you have the VB sample going.

We do not have a sample in VB.Net, but I will get someone started creating
one today. How long it will take is up in the air at the moment.

Thank you for choosing the MSDN Managed Newsgroups,

John Eikanger
Microsoft Developer Support

This posting is provided “AS IS” with no warranties, and confers no rights.
--------------------
| From: <[email protected]>
| Subject: Re: Browser Helper Object in VB.NET
| Date: Wed, 19 Nov 2003 12:27:41 -0500
| Lines: 76
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| Hi John, This is super cool, except its in C#. I need it to be in VB.NET.
| If I could see how to get to the browser events in VB I would be off and
| running. But for now I'm in the hurt locker. :(
|
| I am looking forward to your continued support to resolve an issue which
is
| clearly mine. :) <- This last bit was for ToddT :D Not everyone is a
| pretentious rearend 100% of the time. I limit it to 5-15% ;)
|
| Seriously though John, I appreciate for your very attentive attitude and
| help thus far,
| Joe Johnston
|
|
|
| | > Hi, Joe
| >
| > If this isn't what you need, please respond with more details and I will
| > get a specialist on it:
| >
| >
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwebgen/ht
| > ml/bho.asp
| >
| > Thank you for choosing the MSDN Managed Newsgroups,
| >
| > John Eikanger
| > Microsoft Developer Support
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| > --------------------
| > | Content-Class: urn:content-classes:message
| > | From: "Joe Johnston" <[email protected]>
| > | Sender: "Joe Johnston" <[email protected]>
| > | Subject: Browser Helper Object in VB.NET
| > | Date: Mon, 10 Nov 2003 13:08:20 -0800
| > | Lines: 19
| > | Message-ID: <[email protected]>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="iso-8859-1"
| > | Content-Transfer-Encoding: 7bit
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | Thread-Index: AcOnzsS0Rka85WzoQZy71nQzYYxrcQ==
| > | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| > | Newsgroups: microsoft.public.dotnet.languages.vb
| > | Path: cpmsftngxa06.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:155670
| > | NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
| > | X-Tomcat-NG: microsoft.public.dotnet.languages.vb
| > |
| > | I need a Browser Helper object written in VB.NET Please
| > | point me at a good example.
| > |
| > | Joe
| > | MCPx3
| > |
| > | ~ Hoping this MSDN ng three day turnaround is true.
| > |
| > | Additional info:
| > | What is a BHO? In its simplest form, a BHO is a COM in-
| > | process server registered under a certain registry's key.
| > | Upon startup, Internet Explorer looks up that key and
| > | loads all the objects whose CLSID is stored there. The
| > | browser initializes the object and asks it for a certain
| > | interface. If that interface is found, Internet Explorer
| > | uses the methods provided to pass its IUnknown pointer
| > | down to the helper object.
| > |
| > |
| > |
| >
|
|
|
 
G

Guest

John, there are some derived items in the example you sent. I will look
into that and I believe I will look into trying to use the C# code to call
vb.net functions if I can figure it out. Please keep me up to speed on the
progress of the VB example and I will post my example if I finish first or
pass a milestone.

My thanks for now and in advance for your efforts,
--
Joe Johnston
www.gotboxer.com
www.boxerx.com
A Web Portal for Boxer enthusiasts world Wide. Boxer info, Boxer Stuff.
We have discussion Topics from Boxer Fun to Boxer Health.
 
Y

Yan-Hong Huang[MSFT]

Hello Joe,

Here is one VB.NET sample for your reference:

This is a brief description of the sample
1. Defines the IObjectWithSite COM Interface
2. Implements the IObjectWithSite COM Interface
3. SetSite method receives IUnknown for COM object that implements
IWebBrowser2 and Internet Explorer
Set default Browser's UI and behavior in SetSite
4. Declares RegisterServer Function than handles the registration of the
DLL- When regasm is run this function fires because the ComRegisterFunction
attribute has been applied. This function creates the BHO registry entries
that enable IE to locate the object.
5. Declares RegisterServer Function that un-registers of the DLL. This
function removes the BHO registry entries.
6. Starts IE in TheaterMode when successfully attached to IE process


In order to test it you will have to:
1. Build in the IE directory
OR
2. Give the assembly strong name (sn.exe) and place in the Global Assembly
Cache
3. Register the DLL for Interop using regasm.exe
4. Copy to IE directory Interop.SHDocVw.dll

The sample does not subscribe to events. You will have to implement this
depending on which events you want to sink

************************************************
Imports System.Diagnostics
Imports System.Reflection
Imports Microsoft.Win32
Imports SHDocVw
Imports System.ComponentModel
Imports System.Runtime.InteropServices
Namespace BasicBHOs

<ComImport(), Guid("FC4801A3-2BA9-11CF-A229-00AA003D7352"), _
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface IObjectWithSite
Sub SetSite(<MarshalAs(UnmanagedType.IUnknown)> ByVal pUnkSite As
Object)
Sub GetSite(ByRef riid As Object,
<MarshalAs(UnmanagedType.Interface)>
ByVal ppvSite As Object)

End Interface


<GuidAttribute("F4E44592-01B4-472f-A4C1-CA1BDFE59B50")> Public Class
bhovb
Implements IObjectWithSite
Public m_IE As SHDocVw.InternetExplorer
Sub SetSite(<MarshalAs(UnmanagedType.IUnknown)> ByVal pUnkSite As
Object)
Implements IObjectWithSite.SetSite

Try
m_IE = CType(pUnkSite, InternetExplorer)
'Me.SubscribeToEvents()

Me.Initilize()
Catch
Dim e As Exception
Throw e
End Try

End Sub

Sub GetSite(ByRef riid As Object,
<MarshalAs(UnmanagedType.Interface)>
ByVal ppvSite As Object) Implements IObjectWithSite.GetSite
If m_IE Is Nothing Then

ppvSite = m_IE
Else

ppvSite = Nothing
End If
End Sub




<ComRegisterFunction()> Private Shared Sub RegisterServer(ByVal t
As
Type)

Try
Dim regPrefix As String =
"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects\"
Dim guid As Guid = t.GUID
Dim key As RegistryKey = Registry.LocalMachine
Dim keyname As String = regPrefix & "{" & guid.ToString() &
"} "
key.CreateSubKey(keyname)
Catch
Dim e As Exception
End Try
End Sub

<ComUnregisterFunction()> Private Shared Sub UnRegisterServer(ByVal
t As
Type)

Try
Dim regPrefix As String =
"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects\"
Dim guid As Guid = t.GUID
Dim key As RegistryKey = Registry.LocalMachine
Dim keyname As String = regPrefix & "{" & guid.ToString() &
"} "
key.DeleteSubKey(keyname)
Catch
Dim e As Exception
End Try
End Sub

Public Sub Initilize()
m_IE.TheaterMode = True
End Sub
End Class
End Namespace

Thanks.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Thank you Yan,
I will be checking this out ASAP.

Thanks,
Joe Johnston
www.gotboxer.com
www.boxerx.com
A Web Portal for Boxer enthusiasts world Wide. Boxer info, Boxer Stuff.
We have discussion Topics from Boxer Fun to Boxer Health.
..
Yan-Hong Huang said:
Hello Joe,

Here is one VB.NET sample for your reference:

This is a brief description of the sample
1. Defines the IObjectWithSite COM Interface
2. Implements the IObjectWithSite COM Interface
3. SetSite method receives IUnknown for COM object that implements
IWebBrowser2 and Internet Explorer
Set default Browser's UI and behavior in SetSite
[snip]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top