How to create IE add-ons in VB.NET, C#, C++
for Internet Explorer 6, 7
Add-in Express™
for Internet Explorer® and Microsoft® .net
Add-in Express Home > Add-in Express for Internet Explorer > Online Guide > Programming Internet Explorer addons
Creating an IE add-on project
Add-in Express for Internet Explorer adds a corresponding project template to the Extensibility folder of the New Project dialog. To see the dialog, choose the “File | New | Project…” menu.

This invokes the Add-in Express project wizard that allows selecting a programming language for your Internet Explorer project (VB in our IE project) as well as other options (see also Version-neutral IE add-ons).

The project wizard creates the solution and adds two projects: the add-on project and the setup project.
Add-in Express project structure
A newly created Add-in Express solution is shown below:

Let's walk through the files above.
The files in the Loader folder (adxloader.dll and adxloader.dll.manifest) allow your add-on to load to Internet Explorer. You use the manifest to tune this process. See Add-in Express Loader.
The files in the Resources folder are just sample icons for toolbar buttons. They are pre-added to Icons.resx (see Adding a custom button to IE toolbar). They serve as placeholders and their notions in the add-on properties should be replaced with actual icons.
GlobalData.vb – a class that can store data available for all add-on instances within the process.
IEModule.vb – the heart of the project; provides a number of properties, methods and events that relate to the add-on and its UI interface.
MyIEAddon1.snk – a strong-name key file.
AddinExpress.IE.dll – the Add-in Express assembly.
Interop.SHDocVw.dll – an IE interop.
adxregext.exe – a custom action executable that registers (and unregisters) the add-on (see Deploying your Internet Explorer add-on).
IEModule.vb
IEModule is a core part of your IE add-on. From some point of view, it is the add-on itself. It specifies the name of your Internet Explorer add-on. It stores components that represent toolbars, toolbar buttons, menu items, context menu items, and Explorer bars created by your add-on. In addition, it is a container for other components required for the add-on to function. Finally, it communicates with the IE application to provide you with a complete set of IE events such as BeforeNavigate2 and DownloadComplete.
You access the module's designer and code via the context menu in the Solution Explorer window.

For a newly created project, the module contains the following code:
Imports System
Imports System.Runtime.InteropServices
Imports System.ComponentModel
Imports System.Windows.Forms
Imports IE = Interop.SHDocVw
'Add-in Express .NET for Internet Explorer Module
<ComVisible(True), GuidAttribute("5EAA3032-508C-47A6-BF2F-B52B3D14C709")> _
Public Class IEModule
Inherits AddinExpress.IE.ADXIEModule
#Region " Component Designer generated code. "
'Required by designer
Private components As System.ComponentModel.IContainer
'Required by designer - do not modify
'the following method
Private Sub InitializeComponent()
'
'IEModule
'
Me.ModuleName = "MyIEAddon1"
End Sub
#End Region
#Region " Add-in Express automatic code "
'Required by Add-in Express - do not modify
'the methods within this region
Public Overrides Function GetContainer() As _
System.ComponentModel.IContainer
If components Is Nothing Then
components = New System.ComponentModel.Container
End If
GetContainer = components
End Function
_
Public Shared Sub RegisterIEModule(ByVal t As Type)
AddinExpress.IE.ADXIEModule.RegisterIEModuleInternal(t)
End Sub
_
Public Shared Sub UnregisterIEModule(ByVal t As Type)
AddinExpress.IE.ADXIEModule.UnregisterIEModuleInternal(t)
End Sub
_
Public Class IECustomContextMenuCommands
Inherits _
AddinExpress.IE.ADXIEModule.ADXIEContextMenuCommandDispatcher
End Class
_
Public Class IECustomCommands
Inherits AddinExpress.IE.ADXIEModule.ADXIECommandDispatcher
End Class
#End Region
Public Sub New()
MyBase.New()
'This call is required by the Component Designer
InitializeComponent()
End Sub
Public Sub New(ByVal container As IContainer)
MyBase.New(container)
container.Add(Me)
'This call is required by the Component Designer
InitializeComponent()
End Sub
Public ReadOnly Property IEApp() As IE.WebBrowser
Get
Return CType(Me.IEObj, IE.WebBrowser)
End Get
End Property
Public ReadOnly Property HTMLDocument() As mshtml.HTMLDocument
Get
Return CType(Me.HTMLDocumentObj, mshtml.HTMLDocument)
End Get
End Property
End Class
See an example of an IE6 and IE7 add-on with source code.
Back to Add-in Express for Internet Explorer homepage

