Talking to Internet Explorer

This is a discussion on Talking to Internet Explorer within the Windows Programming forums, part of the Platform Specific Boards category; Hello, everyone.
I'd like to make my own custom IE toolbar that would analyze the URL and the HTML of ...

Talking to Internet Explorer

Hello, everyone.

I'd like to make my own custom IE toolbar that would analyze the URL and the HTML of the Web pages and (say) display an alert if the page contains some harmful content. I've figured out how to create the toolbar and attach it to IE. I can obtain the Explorer window handle and extract the URL from the address ComboBox, but what about the page HTML? Does Internet Explorer provide some API for getting it? And how do I hook my function so that it gets called whenever a page is loaded?

Now if I just understood what the hesk is going on with all those COM interfaces... Basically, I've got a pointer to an IWebBrowser2, which lets me do all sorts of cool things -- that include, of course, getting the raw HTML. I tried to do it like this:

and, of course, Internet Explorer crashed, because the QueryInterface threw an exception (Code 0xc0000005, Flags 0x0, Record 0x0; that's "Access Violation"). And it's COM, it's not supposed to throw exceptions, whatever the circumstances; in the worst case it might return an error code. So, um... would you happen to know what might be the problem?

I think you may have a hard time getting any useful information about programming IE from anyone here. Most of us are standards compliance/anti-spyware pedants and consequently use Mozilla Firefox or Opera as a web browser (and they use a completely different programming model to IE).

Oh, all right; thanks anyway. I only chose IE because I couldn't make head nor tail of the other browsers', er, programming models; plus, I now dabble a little in ATL, so that's two benefits for the price of one . When I will have finished the IE extension, I'll try to adapt it for Firefox, too -- if I ever manage to load my DLL using their JavaScript(tm)

For future reference, 0xc0000005 is STATUS_ACCESS_VIOLATION (from WinNT.h), and is usually caused by trying to read or write from an invalid memory address. In this case, you were trying to write to the memory address NULL.