index > Internet Explorer Extension Development > How to catch certain browsing events

How to catch certain browsing events


Hi everyone,
i'm currently developing a BHO with ATL as i'm in need to write an application that would record the interaction between a user and the browser while surfing the internet.
With my BHO i'm able to get notification of the events thanks to the DIID_DWebBrowserEvents2 interface. This way i can record when new windows are opened, a page is navigated to, a print template is istantiated and so on.
But this just takes care of half of the events i'd like to catch. What i'd like to record too is when a user presses the back, forward and refresh button, saves a page or the content of a link, adds a bookmark, and similar. I can't get notifications of those events from the DWebBrowserEvents2 interface.
How could i manage in getting this information? (Someone told me about "subclassing the IE standard toolbar" to intercept the WM_COMMANDS messages from the buttons hosted in the toolbar; is it a good and straightforward way to do it?)
I already know C++, but i'm not used to write code dealing with MS tecnologies, so beside giving me a few tips to answer my question if you could even point me to some code snippets would be largely appreciated!

Thanks in advice to everyone who will gave his/her input!
Regards,

Davide Magistri
Davide Magistri
Here are the DHTML methods. http://msdn.microsoft.com/workshop/author/dhtml/reference/methods.asp


As a specific example, the "back" functionality is described here: http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/back.asp

Hope that aims you in the right direction.

William
WilliamPHenryJr
The seminal article on BHO is at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwebgen/html/bho.asp?frame=true&hidetoc=true

In it you'll find this:

To intercept the events fired by the browser, the BHO needs to connect to it via an IConnectionPoint interface and pass the IDispatch table of the functions that will handle the various events. The pointer to IConnectionPointContainer obtained previously is used to call the FindConnectionPoint method that returns a pointer to the connection point object for the required outgoing interface: in this case, DIID_DWebBrowserEvents2. The following code shows how the connection takes place:

HRESULT CViewSource::Connect(void)
{
HRESULT hr;
CComPtr<IConnectionPoint> spCP;

// Receives the connection point for WebBrowser events
hr = m_spCPC->FindConnectionPoint(DIID_DWebBrowserEvents2, &spCP);
if (FAILED(hr))
return hr;

// Pass our event handlers to the container. Each time an event occurs
// the container will invoke the functions of the IDispatch interface
// we implemented.
hr = spCP->Advise( reinterpret_cast<IDispatch*>(this), &m_dwCookie);
return hr;
}


(it goes on...)

Good luck,
William
WilliamPHenryJr
reply 3

You can use google to search for other answers

 

More Articles

• Open new tab
• Internet Exploerer event model
• Set IE as default browser Button
• One Instance of Band Object
• Point where the panel of exploration begins.
• How to prevent a BHO from crashing Explorer.exe
• Data Exchange between IE and Office 2003
• "IWebBrowser2::ToolBar Property" broken in IE7 RC1 ?
• IConnectionPoint::Unadvise fails in IE7
• problem with iexplorer ActiveX stealing focus
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

• my binarycode cannot add new object in w
• Development using visual C# -->Weak n
• Why cannot BHO receive the DocumentCompl
• Dont Fire NewWindow3 when new TAB is ope
• IE7
• Passing MSXML document to a activex cont
• Is it possible to get raw HTTP requests
• Data Exchange between IE and Office 2003
• BODY.scrollTop = 0 When CompatMode=BackC
• Why does IE7 always popup the prompt win
• Passing JScript string array to Activex
• BHO works in IE6 but not IE7
• Link replacement addin
• IConnectionPoint::Unadvise fails in IE7
• How to catch certain browsing events

Hot Articles

• Point where the panel of exploration beg
• window handle for active tab
• Develop Activex to call from JScript
• BHO works in IE6 but not IE7
• Is it possible to get raw HTTP requests
• Want to replicate Flash player...
• How to prevent a BHO from crashing Explo
• Set IE as default browser Button
• Data Exchange between IE and Office 2003
• problem with iexplorer ActiveX stealing
• Passing MSXML document to a activex cont
• Problem using activex control in two ins
• special character as a part of searchbar
• IE7
• Missing History in IE7

Recommend Articles

• Listening to IE events
• Selectively Removing IE History
• How to get current displaying URLs?
• Internet Exploerer event model
• Developing application hosting multiple
• How do I get the notification when the a
• Passing JScript string array to Activex
• Manipulate page in a frame from JScript
• Missing History in IE7
• WebBrowser Control not loading java appl
• IE7 Tabs
• How to automate selection of items from
• IConnectionPoint::Unadvise fails in IE7
• Please a very simple sample for BHO usin
• Vist or IE7 and Cookies