tags:

views:

65

answers:

2

My objective is to have an event that is triggered when a website is accessed. Now, maybe through the window title, or the text in the window. Or maybe even reading a URL.

As of now I am aware of FindWindow (class,title); However all attempts to put this line of code into a loop and it's exit condition being when the window appears have been fruitless.

Any assistance would be very helpful.

A: 

Looking for window titles can be a bit problematic. I don't know how much control you have over the desktop, but you might consider building an addon for Firefox (or the equivalent in IE) to look for this particular site.

https://developer.mozilla.org/En/Extensions/Firefox

You might also consider building a simple local proxy server (depending on what you are doing) that looks for this site and performs some action. You would have to make sure all the browsers on the machine point to this local proxy to get it working correctly. See the link below for some discussion on a custom proxy server:

http://stackoverflow.com/questions/226784/how-to-create-a-simple-proxy-in-c

Andrew Burke
+1  A: 

That's not possible. At least if I understood you correctly. You want to register a callback when ANY software on your machine accesses a specific website?

Just imagine a browser uses SSL, there is no way to detect this by listening to the traffic or something similar.

However, if you want to be notified about all connections to a specific IP, then you could use sniffing mechanisms of your kernel or even redirect all traffic to this IP to a proxy you have set up with iptables or similar.

Windows has a sniffing library called WinPCap, on linux you could use tcpdump. Though, more information about your problem would be nice.

David Herrmann