personx1212 0 Newbie Poster

hi, i want to be able to intercept IE connections and get the URL before the contents are downloaded, either when clicking on a link or entering the address directly in the Addressbar, i found some examples on the web and made some changes but still some things are not clear.

>>> import win32com.client
>>> ie_mod=win32com.client.gencache.EnsureModule('{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}',0,1,1)
>>> class IE_Events(ie_mod.DWebBrowserEvents2):
    def BeforeNavigate2(self, pDisp, URL):
        print 'OnNavigateComplete2:', URL

>>> ie=win32com.client.DispatchWithEvents('InternetExplorer.Application',IE_Events)

i think through the above i can only get events from IE instances i launch my self:

>>> ie.Visible = True
>>> ie.Navigate('http://www.google.com')

-------------------------------------------

but how can i setup a listener/hook to get events from any IE instance, can you please give me some pointers on how a simple URL logger work?

Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.