Method for Monitoring URL activity- Restart IE whenever it has not gotten a new URL every 5 mins.

J

Jim Mcduggan

We have a C++ app that restarts IE if it dies, but we want to add 1 more
function and wonder the best way, if even possible to do it.

We would like to restart IE whenever it has not gotten a new URL every 5
mins. ( our screensaver page does a 3 min refresh, so if it has not
refreshed that url then either the net is down or IE is frozen).

So are there any system calls I can do from my win32 C++ app to figure our
if IE has had http activity within 5 mins?

Thanks
Jim
 
S

Scherbina Vladimir

Writing BHO allows you to control all IE events. You can react on
BeforeNavigate, DocumentComplete, NavigateError and other events, make "time
estimations" and call *->Quit() if necessary.

The simplest solution for you is to save time to some variable in
DocumentComplete/BeforeNavigate handler, start some thread that calculates
how much time've passed since last DocumentComplete/BeforeNavigate was
invoked and close browser if that value is greater then 5 minutes.

BTW, this is not good idea - to close browser after some inactivity,
because user might change his local time and all his opened pages will
disappear...Maybe you should change your approach to the problem ?
 
J

Jim Mcduggan

Good suggestion Vladimir.
The machine is a Kiosk, so we are not worried about the time changing.
Can we write a BHO inside our c++ .exe daemon application or does it have to
be it's own file/application?
Is there any other way than a BHO, maybe even at the winsock layer?
 
S

Scherbina Vladimir

Jim Mcduggan said:
Good suggestion Vladimir.
The machine is a Kiosk, so we are not worried about the time changing.
Can we write a BHO inside our c++ .exe daemon application or does it have
to
be it's own file/application?
Is there any other way than a BHO, maybe even at the winsock layer?


Sorry, I know nothing about Kiosk (btw, in russian it has interesting
meaning, not connected with computers at all :) ), but you may implement BHO
(its inproc COM component that is represented as DLL) that will be
communicating with your *.exe application (if necessary) using IPC.

Note, that this is win32 specific techinque. For more information read this
article:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwebgen/html/bho.asp
(Browser Helper Objects: The Browser the Way You Want It).

As for another ways: there is no another documented way to detect that
browser is idle. Sure, you may write driver (or LSP, etc) that intercepts
network packets, or hook windows messages, or enumerate ShellWindows items,
retrieving items path, and then make comparisons whenether it changed for
last 5 minutes, etc... but all those approaches are overheat.
 

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