Home All Groups Group Topic Archive Search About

Creating an OCX that is a BHO (Browser Helper Object)

Author
1 Jun 2005 10:17 AM
Csaba Gabor
I would like to create a BHO (Browser Helper Object) as an .OCX using
the VB5CCE.  However, I am stuck from the getgo, and can't even get out
the barn door.  Near as I understand, I need to do like so:

Implements IObjectWithSite
and
Private Sub IObjectWithSite_GetSite(ByVal priid As VBShellLib.REFIID, _
                                          ppvObj As VBShellLib.VOID)
and
Private Sub IObjectWithSite_SetSite(ByVal pSite As
VBShellLib.IUnknownVB)


When I type the first word (in the user control), intellisense shows me
a whole list of possibilities, but IObjectWithSite is not one of them.
If I write that in anyway and try to create the .OCX, VB5CCE complains
mightily with:
Compile Error:
User-defined type is not defined

But I have not a clue as to whether I need to set a reference, move
Implements elsewhere (e.g. class/module/user control - I've tried them
all), or what I should do.  Similarly, intellisense doesn't know about
VBShellLib.

If someone could just help me get started or provide a framework, I'd
be much obliged.

Thanks,
Csaba Gabor from Vienna


Background: I want to write some code in VB/VBScript that monitors all
instances of IE.  I've posted the framework for one way to accomplish
this (along with numerous references) using SHDocVW at:
http://groups-beta.google.com/group/microsoft.public.scripting.vbscript/browse_frm/thread/fb37977720411d57/

The method described there is a VBScript TSR that loads up a single
intance of an .OCX (thanks for your comments, Joe Earnest).  However,
the web says that the standard technique is actually to use a BHO.  At
this point, I don't know if it should be more efficient, but it
certainly seems like it would cut down on the overhead associated with
maintaining the single instanceness of the SHDocVW variant.

Author
1 Jun 2005 7:39 PM
Jeff Johnson [MVP: VB]
Show quote Hide quote
"Csaba Gabor" <Cs***@z6.com> wrote in message
news:1117621076.473472.38230@f14g2000cwb.googlegroups.com...

>I would like to create a BHO (Browser Helper Object) as an .OCX using
> the VB5CCE.  However, I am stuck from the getgo, and can't even get out
> the barn door.  Near as I understand, I need to do like so:
>
> Implements IObjectWithSite
> and
> Private Sub IObjectWithSite_GetSite(ByVal priid As VBShellLib.REFIID, _
>                                          ppvObj As VBShellLib.VOID)
> and
> Private Sub IObjectWithSite_SetSite(ByVal pSite As
> VBShellLib.IUnknownVB)
>
>
> When I type the first word (in the user control), intellisense shows me
> a whole list of possibilities, but IObjectWithSite is not one of them.
> If I write that in anyway and try to create the .OCX, VB5CCE complains
> mightily with:
> Compile Error:
> User-defined type is not defined
>
> But I have not a clue as to whether I need to set a reference

You need to set a reference. I have no idea what typelib to tell you to
refer to, but that's what you need.
Author
2 Jun 2005 12:50 PM
Steven Burn
http://surl.co.uk/?1499

Original URL: http://www.avidoffice.com/docushare/dsweb/Get/Document-2918/Builder.com+Add+functionality+with+a+BHO.htm

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Show quoteHide quote
"Jeff Johnson [MVP: VB]" <i.get@enough.spam> wrote in message news:uK62aGuZFHA.580@TK2MSFTNGP15.phx.gbl...
>
> "Csaba Gabor" <Cs***@z6.com> wrote in message
> news:1117621076.473472.38230@f14g2000cwb.googlegroups.com...
>
> >I would like to create a BHO (Browser Helper Object) as an .OCX using
> > the VB5CCE.  However, I am stuck from the getgo, and can't even get out
> > the barn door.  Near as I understand, I need to do like so:
> >
> > Implements IObjectWithSite
> > and
> > Private Sub IObjectWithSite_GetSite(ByVal priid As VBShellLib.REFIID, _
> >                                          ppvObj As VBShellLib.VOID)
> > and
> > Private Sub IObjectWithSite_SetSite(ByVal pSite As
> > VBShellLib.IUnknownVB)
> >
> >
> > When I type the first word (in the user control), intellisense shows me
> > a whole list of possibilities, but IObjectWithSite is not one of them.
> > If I write that in anyway and try to create the .OCX, VB5CCE complains
> > mightily with:
> > Compile Error:
> > User-defined type is not defined
> >
> > But I have not a clue as to whether I need to set a reference
>
> You need to set a reference. I have no idea what typelib to tell you to
> refer to, but that's what you need.
>
>