From: Sneha Menon on
Hi friends

I use a custom web browser made in vb6 for my personal use; say
limited use - my colleaques also use it at my work place. Everything
fine - but when we right click on a link and point to open in new
window the target page will open in internet explorer(the default web
browser) instead of my custom browser. What shall I do to get the link
open in another copy of my custom browser itself? Subclassing? I have
no much idea about subclassing. But with a detailed instruction may be
I can do it.
Please give any idea how to proceed.

Thank you in advance

SM
From: mayayana on
If you set a reference to mshtml.dll you
can get early binding to the IE DOM. That
gives you access to the document.

Each new page is a new instance, so you
can't just access the Document object. You
have to re-get it with each page load.

---------------

In the form that has the WB, put this:

Private WithEvents Doc As HTMLDocument

------------------

Then add this so that you'll always have
access to the document:

Private Sub WB_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Set Doc = Nothing
If Not WB.Document Is Nothing Then
Set Doc = WB.Document
end if

----------------------------------------------
To block the IE context menu add this:

Private Function Doc_oncontextmenu() As Boolean
Doc_oncontextmenu = False
End Function
---------------------------

With that done you should be able to use the
Doc events to show your own popup menu.
Something like the following. (This is "air
code" but it should be about right.)

Private Sub Doc_onmousedown()
Din sURL as string
'-- quit if not a right click:
If Doc.parentWindow.Event.button <> 2 then exit sub
If Doc.parentWindow.Event.srcElement.tagName <> "A" then exit sub
sURL = Doc.parentWindow.Event.srcElement.href


...sURL is now the link's target and you're
ready to show your own popup menu with
"Open in New Window". But I guess you'll
still need to figure out how you're going to
deal with multiple browser windows when you
presently only have 1 WB. Maybe you can
create a new FormBrowser? I'm not sure.

The WB is really just an IE browser
window, and the hWnd changes with a new
page. So going through the document object
is probably the only way to go. You *can*
get the browser hWnd in each
WB_DocumentComplete event, if you need
it, but you probably won't.


>
> I use a custom web browser made in vb6 for my personal use; say
> limited use - my colleaques also use it at my work place. Everything
> fine - but when we right click on a link and point to open in new
> window the target page will open in internet explorer(the default web
> browser) instead of my custom browser. What shall I do to get the link
> open in another copy of my custom browser itself? Subclassing? I have
> no much idea about subclassing. But with a detailed instruction may be
> I can do it.
> Please give any idea how to proceed.
>
> Thank you in advance
>
> SM


From: MikeD on


"Sneha Menon" <spiderangelo(a)gmail.com> wrote in message
news:1549c2e9-adbc-45b9-b49e-bb901da0bd3b(a)l12g2000prg.googlegroups.com...
> Hi friends
>
> I use a custom web browser made in vb6 for my personal use; say
> limited use - my colleaques also use it at my work place. Everything
> fine - but when we right click on a link and point to open in new
> window the target page will open in internet explorer(the default web
> browser) instead of my custom browser. What shall I do to get the link
> open in another copy of my custom browser itself? Subclassing? I have
> no much idea about subclassing. But with a detailed instruction may be
> I can do it.
> Please give any idea how to proceed.


Not directly addressing your question, but perhaps a suitable alternative...

If you and your colleagues wish to use your custom browser, why not make it
the default? Problem solved.

--
Mike


From: Sneha Menon on
Mayayana,

I had a gut feeling that your suggestion would work. But unfortunately
it is not possible to set a reference to mshtml.dll.
It says something like 'reference cannot be set to this item'

Any alternate methods?

As for MikeD's suggestion..
I had tried it. It works for 2 or 3 days.(I am not alone here,
Googling will show you there are quite a few people who experienced
it) Then IE will be back. As long as I keep My browser away from
program files folder, and NOT making it default
everything OK, except the issue I started the thread with.

anyway thanks (both of you) for your responses.

still looking.


SM
From: mayayana on
> I had a gut feeling that your suggestion would work. But unfortunately
> it is not possible to set a reference to mshtml.dll.

Woops. Sorry, I meant mshtml.tlb. That should
be in the system folder, along with mshtml.dll.
(It uses an external typelib.)