Click here to Skip to main content
14,977,931 members
Articles / Multimedia / GDI+
Posted 9 Sep 2008


121 bookmarked

Pretty IE Toolbar in C#

Rate me:
Please Sign up or sign in to vote.
4.89/5 (39 votes)
9 Sep 2008CPOL5 min read
The article describes the work principles and ways of use of IEToolbarEngine. This is a toolbar for Internet Explorer, which has a reusable architecture.


One of our clients approached us with an idea to create a commercial toolbar for Internet Explorer. The idea was simple – it was necessary to implement a toolbar for Internet Explorer 7.0 containing the following elements:

  • company logo;
  • search field, allowing to send a search request to an arbitrary site and display the results in the browser;
  • expand buttons, containing arbitrary number of links;
  • drop-down lists displaying RSS-channels.

We started to work on this task and started with a choice of a platform. As it turned out, it is not a simple thing to make a toolbar for Internet Explorer with a declared functionality. It is necessary to deal with Com-components, interact with the browser and store cashed data somewhere. Fortunately, it appeared that it is possible to do everything on the .NET 2.0. platform, which simplified the task a lot.

The result of our work is given below – it is the IEToolbarEngine component, presenting high level interface for toolbars and its elements creation. Perhaps, this component will allow you to implement your own toolbars or you will find some useful data for the implementation of your own projects in the MS Visual Studio environment in the description of this device.


IEToolbarEngine is inherited from BandObject component, written by Pavel Zolnikov and described in the article “Extending Explorer with Band Objects using .NET and Windows Forms.” We modified it so it would be possible to build our toolbar in Internet Explorer. After that, we wrote a small library of classes enabling to add different elements into the toolbar.

If to speak generally, the toolbar presents itself UserControl with the System.Windows.Forms.ToolStrip component placed on it. At the loading of this control, the CreateToolbarItems function is activated, which should be paid great attention, as the main initialization of a toolbar elements happen in it. You can bring changes into it for the creation of your own toolbar. Its fragment is given below.

internal void CreateToolbarItems ()
        //Get current assembly.
        Assembly currentAssembly = Assembly.GetAssembly( this.GetType() );
        //Links cration.
        Link link1 = new Link("Home page", "");

        Link link2 = new Link("Clear Search History",

		//Getting image from resources
        Image img = Image.FromStream( currentAssembly.GetManifestResourceStream(
            "IEToolbarEngine.main.png") );

		//Create toobar item.
        menu = new MainMenu( this, "Company", "Main", 
                new Link[] { link1, link2 }, img);

       	//Add item to internal collection         
        items.Add (menu);

A creation of one toolbar element is demonstrated here, this element contains a logo and a brief drop-down menu. An item is created with the help of the MainMenu class. Two links and an image are added to it. The classes diagram displaying a simple architecture of toolbar elements is given below:

Class deagram

A created element will look like that:

Main menu sample

Title text, tips, array of links (KeyValuePair<string, string> class objects, where Key -- menu item text and value -- link for transfer with a click on it) and a link to the image received from the assembly resources are given to the MainMenu class constructor.

Let us note, for those who are curious, that name of a resource embedded into the assembly is formed from the default namespace name, and from the resource name itself (hence, the line IEToolbarEngine.main.png).

After a creation, it is necessary to add a new element into the collection of IEToolbarEngine Items class.

Creation of several elements is demonstrated in the IEToolbarEngine project attached to this article. Lets view them in consequence.


new SearchBoxItem (this, "<clear>", "terms to serach!",
               "Search here", "Search", "Click to search",new Size (160, 16), 
               FlatStyle.System, img);

The SearchBoxItem class presents itself a search line with a button starting the search. The line can navigate to an arbitrary site supporting a search with parameters specified in GET request.

The following parameters are specified to the constructor: link to the IEToolbarEngine class, a line which will be displayed in combobox for item of search history clearing, prompt line, search line, pop-up prompt line, text on search button, search field size, its style and a link to the image for search button. This element will look like that:

Main menu sample

A few words about search line format. There is a q={0} parameter in it. Here q is parameter name, used in your search query, and {0} will be automatically substituted to the line which a user enters into search line. If there is another parameter name in your search query, it should be staned instead of q.


LinkListItem(this, "Advantages", "Advantages", 
                    new Link[] { link1, link2, link3, link4 }, img);

Simple list with links. Constructor parameters -- link to IEToolbarEngine class, button text, tooltip text, massive of elements. The exterior is shown below:

Main menu sample


RssTicker(this, "RSS", "RSS Channel", 
    "", 1440, img, "RSSChannel");

This element presents itself a list of links received from an RSS feed. For that, a link to RSS-feed and a period of channel update is given to a constructor. The string – a unique name of RSS-channel, which will be used for creation of a cash-file in the application folder in "Application Data\IEToolbar\Cache", should be transmitted the last.

The resulting element looks like that:

Main menu sample

Installation Project

Also, the demo project contains an installation project IEToolbarInstallation, generating a Setup.exe file, which allows you to install the toolbar to the user machine and delete it if necessary. It is created by the means of MS Visual Studio. The moments, connected with the implementation of an installation project which should be paid attention to, are given below.

There is a IEToolbarInstaller class, derived from System.Configuration.Install.Installer in the toolbar assembly (IEToolbar.dll, is created by the IEToolbarEngine project). In order to show the installer that this class method should be started in the process of the installation, it is marked by the RunInstallerAttribute attribute. Install and Uninstall methods are overriden in it. Install implements a registration of a build as COM-server. Uninstall, correspondingly, cancels its registration.

RegisterAssembly function of class RegistrationServices is used for registration. It is necessary to note, that this assembly is not installed in GAC, that is why registration should be implemented with the AssemblyRegistrationFlags.SetCodeBase key. For that, it is necessary for the assembly to be strongly named, otherwise, registration can go in a wrong way.

The installer is given a directive to search this class in the build at the installation and start its actions Install and Uninstall. For that, a new action is added into a "Custom Actions" section in the project, for which, IEToolbr.dll file of a build is selected in the "custom action source" field.

Basics for the IEToolbarEngine class BandObject contains Register and Unregister functions. Register is started in the process of registration and executes adding of keys, necessary to embed the toolbar into Internet Explorer, into the windows register. Unregister is started at the installation and deletes the information, connected with the toolbar, from the windows register.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Alexandr Golovanov
Web Developer
Russian Federation Russian Federation
Alexandr Golovanov is a .NET developer at KB_Soft Group, an offshore software development company located in Russia, Novosibirsk. Here he has worked
on various .NET projects.

Comments and Discussions

QuestionThank you very much for your help in solving this problem Pin
Member 1163466510-Jan-17 19:34
MemberMember 1163466510-Jan-17 19:34 
QuestionWPF User control Pin
Ganesh Ramanathan2-Sep-15 23:14
MemberGanesh Ramanathan2-Sep-15 23:14 
QuestionBest article so far...!!! Pin
Swapnil SINHA2-Jun-14 6:45
professionalSwapnil SINHA2-Jun-14 6:45 
QuestionHow to debug the solution? Pin
Aakash Jain19-Jul-13 1:13
MemberAakash Jain19-Jul-13 1:13 
QuestionProblem of compatibility!! Pin
Member 101292891-Jul-13 3:29
MemberMember 101292891-Jul-13 3:29 
Questionexample of simple form toolbar Pin
Mahesh_Bhosale18-Mar-13 23:19
MemberMahesh_Bhosale18-Mar-13 23:19 
QuestionCan u reship compiled in Visual Studio 2012? Pin
HRDTA30-Jan-13 3:56
MemberHRDTA30-Jan-13 3:56 
QuestionCustomization need on this Pin
atifamin20028-Mar-12 0:39
Memberatifamin20028-Mar-12 0:39 
Questioni can't run taht code to see my toolbar after modification Pin
mohamedwasim.net22-Nov-11 1:23
Membermohamedwasim.net22-Nov-11 1:23 
AnswerRe: i can't run taht code to see my toolbar after modification Pin
Member 768837813-Nov-12 15:35
MemberMember 768837813-Nov-12 15:35 
QuestionIts not working in Windows 2008 R2 Pin
sj.abhilash7-Jul-11 2:36
Membersj.abhilash7-Jul-11 2:36 
QuestionRe: Its not working in Windows 2008 R2 Pin
sj.abhilash11-Jul-11 20:15
Membersj.abhilash11-Jul-11 20:15 
QuestionMarquee for scrolling text on the toolbar Pin
Palnika9-Jun-11 21:56
MemberPalnika9-Jun-11 21:56 
GeneralLinkListItem: item images Pin
Victor Y. Sklyar22-Dec-10 5:29
MemberVictor Y. Sklyar22-Dec-10 5:29 
GeneralProblem in develop Pin
moein.serpico29-Sep-10 19:37
Membermoein.serpico29-Sep-10 19:37 
Generalhelp please Pin
tytse23-Aug-10 0:48
Membertytse23-Aug-10 0:48 
GeneralMy vote of 5 Pin
tadivaka5-Jul-10 5:32
Membertadivaka5-Jul-10 5:32 
GeneralGreat Work Pin
Vishal_0078-Jan-10 20:29
MemberVishal_0078-Jan-10 20:29 
Questionhow to add images to menu items Pin
Saradhi t26-Aug-09 1:40
MemberSaradhi t26-Aug-09 1:40 
GeneralGreat Pin
pin3331001-Jul-09 22:26
Memberpin3331001-Jul-09 22:26 
AnswerLet me check Pin
phanvdam30-Jun-09 17:53
Memberphanvdam30-Jun-09 17:53 
Questionhow i can start using this, Pin
Member 27688412-Mar-09 2:20
MemberMember 27688412-Mar-09 2:20 
AnswerRe: how i can start using this, Pin
Vishal_0078-Jan-10 21:12
MemberVishal_0078-Jan-10 21:12 
QuestionProblem Debugging: Can not register Assembly Pin
sert0611-Mar-09 0:35
Membersert0611-Mar-09 0:35 
QuestionRe: Problem Debugging: Can not register Assembly Pin
sert0611-Mar-09 0:38
Membersert0611-Mar-09 0:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.