Home All Groups Group Topic Archive Search About

WebBrowser BeforeNavigate2 - What is pDisp?

Author
10 Dec 2006 7:15 AM
Spam Catcher
Hi all,

I'm using SHDocVw to hook directly into IE. Anyone know what pDisp stands
for?

BeforeNavigate2(ByVal pDisp As Object, ByRef URL As Object, ByRef Flags As
Object, ByRef TargetFrameName As Object, ByRef PostData As Object, ByRef
Headers As Object, ByRef Cancel As Boolean)

Is the pDisp a pointer to the sender?

I'm keeping a list of WebBrower objects in an array - is there a way to use
the pDisp to find the sender of the event?

Thanks.

Author
10 Dec 2006 8:15 AM
Lucian Wischik
Spam Catcher <spamhoneypot@rogers.com> wrote:
>Is the pDisp a pointer to the sender?
>I'm keeping a list of WebBrower objects in an array - is there a way to use
>the pDisp to find the sender of the event?

As per MSDN, pDisp is "Pointer to the IDispatch interface for the
WebBrowser object that represents the window or frame. This interface
can be queried for the IWebBrowser2 interface."

So yes, pDisp points to the IDispatch interface of the sender. And
from it you can QueryInterface to find the IWebBrowser2 of the sender.
Or to find its IUnknown identity.

--
Lucian
Author
10 Dec 2006 4:51 PM
Spam Catcher
Lucian Wischik <lu***@wischik.com> wrote in
Show quoteHide quote
news:ifgnn2th0b20gqq2ui4nh8fo147cpa4bev@4ax.com:

> Spam Catcher <spamhoneypot@rogers.com> wrote:
>>Is the pDisp a pointer to the sender?
>>I'm keeping a list of WebBrower objects in an array - is there a way
>>to use the pDisp to find the sender of the event?
>
> As per MSDN, pDisp is "Pointer to the IDispatch interface for the
> WebBrowser object that represents the window or frame. This interface
> can be queried for the IWebBrowser2 interface."
>
> So yes, pDisp points to the IDispatch interface of the sender. And
> from it you can QueryInterface to find the IWebBrowser2 of the sender.
> Or to find its IUnknown identity.


Thanks Lucian,

I'm not too familiar working with non-managed objects ... do you have any
examples on how to query for the interface in VB.NET?

Thanks.
Author
10 Dec 2006 5:44 PM
Spam Catcher
Spam Catcher <spamhoneypot@rogers.com> wrote in
news:Xns9895789D6DAB5usenethoneypotrogers@127.0.0.1:

> Thanks Lucian,
>
> I'm not too familiar working with non-managed objects ... do you have
> any examples on how to query for the interface in VB.NET?
>
> Thanks.

I found an easier method of checking the status of my browser Windows.

I scan all my active Windows and compare the HWND to the handlers in BHO's
ShellWindows.

From there, I can retrieve the InternetExplorer object and get all the
details I need about the browser.

This seems more reliable than using the BHO's events... as it seems BHO's
events don't fire consistently (there seems to be some MSDN articles
documenting this).