Writing IE add-on in C#, VB.NET, C++.
Tips for Internet Explorer 6 - IE 11.

Add-in Express™
for Internet Explorer® and Microsoft® .net

Add-in Express Home > Add-in Express for Internet Explorer > Online Guide > Tips on Internet Explorer add-ons

IE add-ons tips

On this page you will find some tips and tricks that you may find helpful when programming your IE add-ons.

What are interop assemblies (PIA)?

Interop Assemblies provide the compiler with early-binding information on the host application objects, their properties, and methods. All IE versions are almost 100% backward compatible and you can use interops from IE6 to work with IE7, IE8, IE9, IE10 and IE11. Note, in this case, you can access IE7 features using late binding (see the InvokeMember method in MSDN). Obviously, you cannot expect an add-on developed with, say, IE8 interops to work with IE7 because IE7 does not have some events and properties introduced in IE8.

MyWinApiWindow class

VB.NET

	
			
				Public Class MyWinApiWindow
					Implements System.Windows.Forms.IWin32Window 

					Dim theHandle As IntPtr 

					Public Sub New(ByVal aHandle As System.IntPtr)
						theHandle = aHandle 
					End Sub

					Public ReadOnly Property Handle() As System.IntPtr _
						Implements System.Windows.Forms.IWin32Window.Handle
						Get
							Return theHandle
						End Get
					End Property
				End Class
				

C#

	
				class MyWinApiWindow: System.Windows.Forms.IWin32Window
				{
					System.IntPtr theHandle;

					public MyWinApiWindow(System.IntPtr aHandle)
					{
						theHandle = aHandle;
					}


					#region IWin32Window Members

					IntPtr System.Windows.Forms.IWin32Window.Handle
					{
						get { return theHandle; }
					}

					#endregion
				} 
				

Deploying - shadow copy

The Add-in Express loader uses the ShadowCopy-related properties and methods of the AppDomain class. When you run your add-on, IE loads the Add-in Express loader DLL referenced in the registry. The loader does the following:

  • Finds your add-on DLLs in the DLL Cache. If there are no add-on DLLs in the cache, it copies all assemblies to the cache (including dependencies). The cache folder is located in C:\Documents and Settings\<user name>\Local Settings\Application Data\assembly\dl<number>. If all add-on DLLs (including dependencies) already exist in the cache, it compares their versions. If the versions are not the same, it copies new DLLs to the cache.
  • Loads the add-on DLLs from the cache.

You can see how the add-on versioning influences the add-on loading. This approach (it is built into .NET, as you can see) allows replacing add-on DLLs when the add-on is loaded. The disadvantage is numerous files located in the cache. As far as we know, Microsoft doesn't provide a solution for this problem. You may think you can remove these files in an add-on’s uninstall custom action. However, this will remove the files from the current profile only.

How do I find the PublicKeyToken of my IE add-on?

You can find it in the setup project (that must be already built). Click on your add-on primary output in the setup project and, in the Properties window, expand the KeyOutput property and see the PublicKeyToken property value.

Deploying localized IE add-ons

IE add-ons are localizable in the same way as any Windows Forms application. But pay attention to the deployment of localized resources - see Walkthrough: Localizing Windows Forms on MSDN.

If your questions are not answered here, please see the HOWTOs pages:

How an IE add-on works: tabs, windows, threads, instancing <<

>> IE add-on deployment - Creating MSI installers