Browser Extensions

We can take the code we have so far a step further . . . but only if you have Internet Explorer 5.0 installed on your box. IE 5.0 provides us with the means to add a menu item and toolbar button for our component. There is some grunt work involved, but it’s not too bad. Basically, we have to add a bunch of settings to the registry, and our component needs to implement an additional interface, IOleCommandTarget.

We are also going to become somewhat familiar what another new interface called IServiceProvider. This is because we cannot query the site pointer for IWebBrowser2 like we did for BHOs. We will get access to an IServiceProvider interface that we can use to request the IWebBrowser2. As you will see in Section 12.2.2 later in this chapter, we will have to jump through a few hoops to do this.

Just to keep things a little suspenseful, we’ll wait until the component is wired up and ready to go before we actually discuss its purpose. Exciting, huh?

How Browser Extensions Work

For the most part, browser extensions work just like browser helper objects. But there are some minor differences. For one thing, they are registered differently. When Explorer loads a browser extension, it looks under the following key:

HKEY_LOCAL_MACHINE\
    SOFTWARE\
        Microsoft\
            InternetExplorer\
                Extensions\

There are also some additional registry entries that will provide the toolbar icons and the menu item text, but we’ll discuss them later.

Browser Extension Interfaces

Like BHOs, browser ...

Get VB Shell Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.