Pieter van der Westhuizen

Adding Internet Explorer bars to IE GUI using Add-in Express

Add-in Express for Internet Explorer is yet another tool designed to make the life of developers easier. It provides you with a quick and simple way to customize Microsoft Internet Explorer. In this post I’ll demonstrate how to create an explorer bar for Internet Explorer. We’ll create a simple Add-in Express video downloader Internet Explorer bar, that will list all Add-in Express videos on a particular page.

Start by creating a new ADX IE Add-on Project in Visual Studio 2010.

Creating a new IE add-on project in Visual Studio

Click OK, select your programming language of choice and which Internet Explorer interop assemblies to use.

Selecting C# as a programming language

Finish the New Internet Explorer Add-on Wizard and add a new ADX IE Bar to your project.

Adding a new Internet Explorer Bar

Add the required functionality to the form; I’ve added an Add-in Express logo, 2 labels, a link-label and a list-view:

Adding the required functionality to the form

Add the following code to the link-label’s LinkClicked event:

private void lblClickHere_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
    lvVideos.Items.Clear();
    mshtml.IHTMLElementCollection divCollection =
		(mshtml.IHTMLElementCollection)this.HTMLDocument.getElementsByTagName("div");
 
    foreach (mshtml.IHTMLElement element in divCollection)
    {
        if (element.getAttribute("className") != null &&
			element.getAttribute("className").ToString() == "download_the_video")
        {
            mshtml.IHTMLElementCollection elementChildren =
				element.children as mshtml.IHTMLElementCollection;
            mshtml.IHTMLElement elementChild =
				elementChildren.item(null, 0) as mshtml.IHTMLElement;
 
            ListViewItem lviUrl = new ListViewItem();
            lviUrl.Text = elementChild.getAttribute("href").ToString();
            lviUrl.Tag = elementChild;
            lvVideos.Items.Add(lviUrl);
        }
    }
}

And this code to the DoubleClick event of the list-view:

private void lvVideos_DoubleClick(object sender, EventArgs e)
{
    ListViewItem selectedItem = lvVideos.SelectedItems[0];
    mshtml.IHTMLElement downloadLinkElement =
		selectedItem.Tag as mshtml.IHTMLElement;
    downloadLinkElement.scrollIntoView();
}

Next, switch to the IEModule.cs designer and click on the ellipses (…) button in the Bars property. Set the BarType property to the name of the IE Bar you’ve added previously. Set the MenuText and Title property to Add-in Express Video downloader. Finally set the LoadAtStartup property to True. Setting the AddToolButton property to True will add a menu entry for your add-in to Internet Explorers’ command bar.

Before you build and run your add-in, change the project’s Start external program setting to the Internet Explorer’s path and set the Command line arguments setting to a valid url.

Setting options for debugging

Build, register and run the project and if all went well add-in will search for Add-in Express videos on the webpage and add the url to the listview. When the user double-clicks on the url, it will automatically scroll into view.

Thank you for reading. Until next time, keep coding.

Available downloads:

This sample add-in was developed using Add-in Express for Internet Explorer:
C# sample IE add-on

You may also be interested in:

Creating an Internet Explorer add-on step-by-step
Creating custom Explorer bars

2 Comments

  • Fernando says:

    Olá, você pode mim ajudar?
    Estou tentando pegar links de um site através de um ID, programo em Delphi. Aguardo a resposta. Obrigado!

    [Translation into English]
    Hello, can you help me?
    I’m trying to get links to a website via an ID, I program in Delphi. I await the answer. Thank you!

  • Dmitry Kostochko (Add-in Express Team) says:

    Hi Fernando,

    I am sorry but we do not quite understand the question. Could you please provide more details about your task? Also, please be aware that Add-in Express for Internet Explorer works with Visual Studio only. We don’t have the Delphi edition of this product.

Post a comment

Have any questions? Ask us right now!