 |
| Customizing Microsoft Internet Explorer |
 |
|
| |
Writing a completely custom browser is not a difficult task these days - provided you can rely on the WebBrowser control that is available starting with Microsoft® Internet Explorer 3.0.
The browser helper objects (BHO) introduced with Internet Explorer 4.0 present an opportunity to add even more complex functionality to the original browser.
There is just one aspect missing from all these pre-Internet Explorer 5.0 programming goodies: you couldn't associate new functionality with the browser's user interface.
There was no way to add new toolbar buttons or to customize any of the menus. Thankfully this problem has been addressed starting with release 5 of Internet Explorer.
Let's look at the new ways you can interface with the Internet Explorer UI, the points where the developer is allowed to intervene, and what you can actually obtain through smart coding.
|
 |
| Customizable entities in Internet Explorer 5.0 and above |
 |
|
| |
Internet Explorer technology enables programmers to add new toolbar buttons and menu items. For each one you have to specify the text and icons to add to that particular object, as well as the code that should be run when the user selects the new entry.
The browser has a number of context menus that appear when you right-click an image, a document, a table, an ActiveX® control, selected text or other items.
You can add new items to any of the context menus and have full control over the whole process of displaying the menu. In other words, you can detect when the context menu is about to be redrawn and make your changes on the fly.
Internet Explorer 5.0 comes with a number of related applications that let you work off-line, such as e-mail or news readers, HTML editors and so on. You can modify the list of available applications to fit your needs. The search bar can be enhanced and you can even use your own search panel.
Technologies like Dynamic HTML (DHTML), behaviors and XML provide excellent tools for customizing and extending browser features. You can create a browser implementing the IDocHostUIHandler interface and expose a completely customized object model through that interface's External property (see "Take Total Control of Internet Explorer with Advanced Hosting Interfaces," by Scott Roberts in the October 1998 issue of MIND). You can use behaviors to customize the way a certain HTML tag reacts to user and browser solicitations by extending it with new methods, properties and events.
|
 |
| Customization Techniques |
 |
|
| |
Customization of the Internet Explorer 5.0 user interface involves four elements: COM components, HTML, script files and the registry. By writing a special COM component or script file and entering some keys and values to the registry you can personalize the Internet Explorer interface.
As I mentioned earlier, I won't discuss the COM stuff more deeply here, but I will give you an overview of the COM component you can write to interact with Internet Explorer 5.0.
Basically there are four types of Internet Explorer-specific COM objects: BHOs, BHOs with custom commands, command-only objects and the Explorer DeskBand.
A BHO is a simple COM server that is only required to implement the IObjectWithSite interface. You can create a BHO with ATL by choosing the Internet Explorer object template from the ATL objects gallery. BHOs are also supported by Windows Explorer (if you're running shell version 4.71 or greater) and Internet Explorer 4.0.
BHOs don't necessarily link with the UI; they are just actions you take when starting the browser. BHOs are passed a pointer to the browser's IUnknown interface.
You can add new commands to the browser by writing BHOs, or even simpler COM objects that implement the IOleCommandTarget interface. This interface enables Internet Explorer 5.0 to ask your component to execute a certain function. Such a component needs to be associated with a menu item or a toolbar button.
The difference between a BHO and a COM server implementing IOleCommandTarget is that a BHO can easily access (via the received IUnknown pointer) any object model exposed by the document being viewed.
Band objects provide a flexible and powerful way to extend the capabilities of Internet Explorer by creating custom Explorer Bars. Implementing a desk band enables you to extend the capabilities of normal windows. Although some COM programming is required, it ultimately serves to provide a child window for your user interface.
From there, the bulk of the implementation can use familiar Windows programming techniques.
|
 |
| Creating Custom Explorer Bars, Tool Bands and Desk Bands |
 |
|
| |
The Explorer Bar was introduced with Microsoft® Internet Explorer 4.0 to provide a display area adjacent to the browser pane. It is basically a child window within the Internet Explorer window and it can be used to display information and interact with the user in much the same way.
Explorer Bars are most commonly displayed as a vertical pane on the left side of the browser pane. However, an Explorer Bar can also be displayed horizontally, below the browser pane.
There is a wide range of possible uses for the Explorer Bar. Users can select which option they wish to see in several different ways, including selecting it from the Explorer Bar submenu of the View menu or clicking a toolbar button. Internet Explorer provides several standard Explorer Bars, including Favorites and Search.
One of the ways you can customize Internet Explorer is by adding a custom Explorer Bar. After being registered it will be added to the Explorer Bar submenu of the View menu. When selected by the user, the Explorer Bar's display area can be used to display information and process user input in much the same way as a normal window.
To create a custom Explorer Bar, you must implement and register a band object. Band objects were introduced with version 4.71 of the Shell and provide capabilities similar to those of normal windows. However, because they are COM objects and contained by either Internet Explorer or the Shell, they are implemented somewhat differently.
Simple band objects were used to create the sample Explorer Bars displayed in the first graphic. The implementation of the vertical Explorer Bar sample will be discussed in detail in a later section.
An Explorer deskband is a docking window that you can employ as the left pane of your browser. By default, the deskband is a window within Explorer that shows the shell's namespace. Other predefined deskbands allow you to see the Search, History, and Favorites panels. Usually, the available deskbands are listed under the View | Explorer Bar menu both for Windows Explorer and Internet Explorer.
Tool Bands
A tool band is a band object that was introduced with Internet Explorer 5 to support the Microsoft® Windows® radio toolbar feature. The Internet Explorer toolbar is actually a rebar control that contains several toolbar controls. By creating a tool band you can add a band to that rebar control. However, just like Explorer bands, a tool band is a general purpose window.
Desk Bands
Band objects can also be used to create desk bands. While their basic implementation is similar to Explorer Bars, desk bands are unrelated to Internet Explorer. A desk band is basically a way to create a dockable window on the desktop. The user selects it by right-clicking the taskbar and selecting it from the Toolbars submenu.
The image below presents a Infoband, a window that docks on the left side in IE.

|
|