Catching Browsers URLs with DDE (Views: 100)


I try to catch all URLs that all instances of the web browser visit. I try to achieve this with DDE, but sometimes miss URLs.


I did the same job not long ago. The code works alright with Netscape but with IE you will run into a problem.

If you start IE and then open additional windows with the 'New Window' menu item, then you are running only ONE instance and you will get successfully all URLs.


If you start a second instance of IE by clicking on the icon in your start menu a second.. then only one of your two instances will report DDE messages to your Delphi program. Usually the first started one seems to reply.

There is no clean solution around it.

I ended up enumerating top level windows and manually checking each top level window whether it was an IE instance. Then I would move through the child window chain with FindWindow(), GetWindowClass() and so on.. and retrieve the URL that way. The same code actually worked for IE 4, IE 5.0 and IE 5.5. I did not test with IE 6.

The code needed a modification for Netscape, naturally.

<< Back to main page