WebBrowser BeforeNavigate2 - What is pDisp?

G

Guest

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.
 
L

Lucian Wischik

Spam Catcher said:
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.
 
G

Guest

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.
 
G

Guest

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).
 

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