Add-in Express For IE And

Transcription

Getting Started

Add-in Express for IE and .NETAdd-in Express 2010 for Internet Explorer and .NETAdd-in Express 2010 for Internet Explorer and .NETRevised on 19-Dec-10Copyright Add-in Express Ltd. All rights reserved.Add-in Express, ADX Extensions, ADX Toolbar Controls, Afalina, AfalinaSoft and Afalina Software are trademarks or registered trademarks of Add-in ExpressLtd. in the United States and/or other countries. Microsoft, Outlook, and the Office logo are trademarks or registered trademarks of Microsoft Corporation in theUnited States and/or other countries. Borland and the Delphi logo are trademarks or registered trademarks of Borland Corporation in the United States and/orother countries.THIS SOFTWARE IS PROVIDED "AS IS" AND ADD-IN EXPRESS LTD. MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BYWAY OF EXAMPLE, BUT NOT LIMITATION, ADD-IN EXPRESS LTD. MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY ORFITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE, DATABASE OR DOCUMENTATION WILL RKSOROTHERRIGHTS.page 2

Table of ContentsAdd-in Express for IE and .NETTable of ContentsAdd-in Express 2010 for Internet Explorer and .NET . 2Introduction . 6Why Add-in Express?. 7System Requirements . 8Technical Support . 9What's new in version 2010 . 10Installing and Activating . 11Activation Basics . 11Setup Package Contents . 12Getting Started . 13Add-ons for Internet Explorer . 14Creating a Project . 14Add-in Express Project Structure . 16IEModule . 16Customizing the Internet Explorer UI at a Glance . 19Custom Toolbar Buttons and Menu Items . 21Comparing the Ways . 21IE Command . 21Adding a Custom Toolbar Button . 22Adding a Custom Menu Item . 23Adding Custom Controls onto the Standard IE Toolbar. 24Adding a Custom Item to the Main Menu . 25Custom Toolbars . 26Custom Explorer Bars . 29Custom Context Menu Commands . 32Intercepting Keyboard Shortcuts . 32Handling HTML Events . 33How Your Add-on Loads into IE . 34Shims . 34Add-in Express Loader . 34How Your Add-on Works. 35IE Module Basics. 35Tabbing . 36Windowing and Threading . 36Instancing . 37Messaging . 38Deploying Your Add-on . 40Setup Project Wizard . 40Creating a Setup Project Manually . 42Add a New Setup Project . 42File System Editor . 42Primary Output . 42Project-dependent Resources . 44Add-in Express Loader and Manifest . 44MSHTML Interop Assembly . 45Custom Actions . 45page 3

Table of ContentsAdd-in Express for IE and .NETDependencies . 45PostBuildEvent . 45Prerequisites . 45IE Bar only . 46Deploy . 47Web-based Deployment and Update . 48On the Development PC . 49On the Target PC . 52Add-in Express Tips and Notes . 54Common stuff . 54What are interop assemblies? . 54Deploying and Debugging . 54Debugging . 54Deploying – Shadow Copy . 54How Do I Find the PublicKeyToken of My Add-in? . 55Deploying Localized IE Add-ons. 55Version info.xml . 55Finally . 55page 4

Add-in Express for IE and .NETWhy Add-in Express?IntroductionAdd-in Express for Internet Explorer and .NET is a development tool designed tosimplify and speed up the development of add-ons for Internet Explorer 6 and 7 inVisual Studio 2005 and Visual Studio 2008 through the consistent use of the RADparadigm. It provides a number of specialized components that allow the developer towalk through the interface-programming phase to the functional programming phasewith a minimal loss of time.page 5

Why Add-in Express?Add-in Express for IE and .NETWhy Add-in Express?The Microsoft IE SDK gives developers the ability to extend Internet Explorer with Browser Extensions. This termincludes features such as shortcut menu extensions, custom toolbars, Explorer bars, and Browser HelperObjects (BHOs). Further on, we will use the term "add-on" instead of Browser Extensions.When creating IE add-ons with Add-in Express, you overcome the basic problem – building your solutions intothe IE application. Based on the True RAD paradigm, Add-in Express saves the time that you would have tospend on research, prototyping, and debugging numerous issues when creating an add-on for IE in VisualStudio.Add-in Express provides you with simple tools for creating version-neutral, secure, isolated, managed, anddeployable extensions for Internet Explorer. Managed IE add-onsYou develop them in every programming language available for Visual Studio .NET. Isolated IE add-onsAdd-in Express loads add-ons into separate application domains. Therefore, they do not have a chance to breakdown Internet Explorer. Version-neutral IE add-onsThe Add-in Express programming model and its core are version-neutral. That is, you can develop one add-onthat will work in both Internet Explorer 6 and 7. Deployable IE add-onsAdd-in Express automatically supplies you with a setup project making your solution ready-to-deploy.page 6

System RequirementsAdd-in Express for IE and .NETSystem RequirementsSupported Visual Studio Editions Visual Studio .NET 2010 Visual Studio .NET 2008 Team System Visual Studio .NET 2008 Professional Edition Visual Studio .NET 2008 Standard Edition Visual Studio .NET 2005 Team System Visual Studio .NET 2005 Professional Edition Visual Studio .NET 2005 Standard Edition RemObjects Chrome 1.53 and higher.NET Framework .NET Framework 2.0, 3.0, 3.5, 4.0Supported Languages Visual Basic .NET 2010 Visual Basic .NET 2008 Visual Basic .NET 2005 Visual C# 2010 Visual C# 2008 Visual C# 2005 Visual C .NET 2010 Visual C .NET 2008 Visual C .NET 2005Internet Explorer Internet Explorer 6.x Internet Explorer 7.x (32-bit and 64-bit) Internet Explorer 8.x (32-bit and 64-bit)page 7

Technical SupportAdd-in Express for IE and .NETTechnical SupportAdd-in Express is developed and supported by the Add-in Express Team, a branch of Add-in Express Ltd.The Add-in Express web site at www.add-in-express.com provides a wealth of information and softwaredownloads for Add-in Express developers, including the HOWTOs section with sample projects answering mostcommon "how to" questions.For technical support through the Internet, e-mail us at support@add-in-express.com or use our forums. We areactively participating in these forums.page 8

What's new in version 2010Add-in Express for IE and .NETWhat's new in version 2010 Support for Windows 7 Support for Visual Studio 2010 Support for .NET Framework 4.0 Support for 64-bit versions of IE 7 and IE 8 Updated project wizard New setup project wizard Support for localized setup projectspage 9

Installing and ActivatingAdd-in Express for IE and .NETInstalling and ActivatingThere are two main points in the Add-in Express installation. First off, you have to specify the developmentenvironments in which you are going to use Add-in Express. Second, you need to activate the product. Whatfollows below is a brief guide on activation.Activation BasicsDuring the registration process, the registration wizard prompts you to enter your license key. The key is a 30character alphanumeric code shown in six groups of five characters each (for example, AXN6M-GBFTK-3UN78MKF8G-T8GTY-NQS8R). Keep the license key in a safe location and do not share it with others. This productkey forms the basis for your ability to use the software.For purposes of product activation only, a non-unique hardware identifier is created from general information thatis included in the system components. At no time are files on the hard drive scanned, nor is personallyidentifiable information of any kind used to create the hardware identifier. Product activation is completelyanonymous. To ensure your privacy, the hardware identifier is created by what is known as a "one-way hash".To produce a one-way hash, information is processed through an algorithm to create a new alphanumeric string.It is impossible to calculate the original information from the resulting string.Your product key and a hardware identifier are the only pieces of information required to activate theproduct. No other information is collected on your PC or sent to the activation server.If you choose the Automatic Activation Process option of the activation wizard, the wizard attempts to establishan online connection to the activation server, www.activatenow.com. If the connection is established, the wizardsends both the license key and the hardware identifier over the Internet. The activation service generates anactivation key using this information and sends it back to the activation wizard. The wizard saves the activationkey to the registry.If an online connection cannot be established (or you choose the Manual Activation Process option), you canactivate the software using your web-browser. In this case, you will be prompted to enter the product key and ahardware identifier on a web page, and will get an activation key in return. This process finishes with saving theactivation key to the registry.Activation is completely anonymous; no personally identifiable information is required. The activation key can beused to activate the product on that computer an unlimited number of times. However, if you need to install theproduct on several computers, you will need to perform the activation process again on every PC. Please referto your end-user license agreement for information about the number of computers you can install the softwareon.page 10

Installing and ActivatingAdd-in Express for IE and .NETSetup Package ContentsThe Add-in Express 2010 for Internet Explorer and .NET setup program installs the following folders on your PC: Bin – binary files Docs – documentation Images – icons Interop Assemblies – version-neutral interops Redistributables – redistributable files Sources – source code (see the note below).Where is the Add-in Express source code?Please note that the source code of Add-in Express is or is not delivered depending on the productpackage you purchased. See the Feature Matrix page on our web site for details.Add-in Express for IE and .NET setup program installs the following text files on your PC: licence.txt – EULA readme.txt – short description of the product, e-mail addresses and such whatsnew.txt – this file describes the latest information on the product features added and bugs fixed.page 11

Getting StartedAdd-in Express for IE and .NETGetting StartedIn this chapter, we guide you through the following steps of developing Add-in Express projects: Creating an Add-in Express project Adding Add-in Express components to the designer Building, registering, and debugging the Add-in Express project Tuning up the Add-in Express loader based setup project Deploying your project to a target PCThe UI described in this document is created by the add-on available for download atC# - om-ie-ui-vs2005-cs.zipVB - om-ie-ui-vs2005-vb.zippage 12

Creating a ProjectAdd-in Express for IE and .NETAdd-ons for Internet ExplorerCreating a ProjectAdd-in Express adds several project templates to the Extensibility folder of the New Project dialog. To see thedialog, choose the “File New Project ” menu.As you can see, there are IE Add-on, IE Bar and IE Toolbar project templates in this dialog. They produceprojects that differ in small details such as type names. You can't create IE toolbars in the IE Bar project and viceversa, you can't create IE bars in the IE Toolbar project. IE Add-on allows combining toolbars and IE bars in oneproject. However, the most essential difference lies in their deployment. The only IE extension type that isinstallable by a standard user is IE Bar. All other project types require administrative privileges when yoursolution is installed on the target PC.To create a project, select an appropriate project template icon and click OK. This invokes the Add-in Expressproject wizard (see below).page 13

Add-in Express for IE and .NETCreating a ProjectThe project wizard allows selecting the programming language and interop assemblies to be used in yourproject. Selecting a programming language is of course a straightforward action. Choosing the correct interoprequires understanding. The following table illustrates this option in more detail:The Interop Assemblies optionIE version installed on thedevelopment PCIE versions supported by theadd-onVersion-neutral (IE 6 and higher)IE6, IE7, or IE8IE6, IE7, and IE8For the currently installed IE versionIE6IE6, IE7, and IE8For the currently installed IE versionIE7IE7 and IE8For the currently installed IE versionIE8IE8To access properties or methods defined in a newer IE version, you use late binding (seeType.InvokeMember in MSDN). To use constants defined in a newer IE version, you must know them; wesuggest using the .NET Reflector to obtain constants defined in newer versions of IE . As to events, the IEmodule provides all events; just use an appropriate one.The second window of the project wizard allows choosing between using the existing .SNK file or creating a newone.page 14

Add-in Express Project StructureAdd-in Express for IE and .NETAdd-in Express Project StructureA newly created Add-in Express solution is shown on the screenshot:Let's walk through the files.The files in the Loader folder (adxloader.dll, adxloader64.dlland adxloader.dll.manifest) get your add-on to load intoInternet Explorer. You use the manifest to tune this process.See Add-in Express Loader.The files in the Resources folder are just sample icons fortoolbar buttons. They are pre-added to Icons.resx (seeAdding a Custom Toolbar Button). They serve asplaceholders only and you need to replace them with actualicons in your add-on.IEModule.vb – the heart of the project; provides properties,methods and events relating to the add-on and its UI. SeeIEModule.MyIEAddon1.snk – a strong-name key file.IEModuleIEModule is the core part of the add-on. From some point of view, it is the add-on itself. It specifies the name ofyour add-on and stores components that represent toolbars, toolbar buttons, menu items, context menu items,and Explorer bars created by your add-on. In addition, it is acontainer for other components required for the add-on tofunction. Finally, it communicates with the IE application toprovide you with a complete set of IE events such asBeforeNavigate2 and DownloadComplete.You access the module's designer and code via the contextmenu in the Solution Explorer window.The designer surface of the IEModule provides a context menu revealing a number of commands; youuse these commands to add Add-in Express components to the module.For a newly created project, the module contains the code shown below. Pay attention to the IEApp andHTMLDocument properties; you will certainly use them in your code.page 15

Add-in Express for IE and odelSystem.Windows.FormsIE Interop.SHDocVw'Add-in Express for Internet Explorer Module ComVisible(True), 7") Public Class IEModuleInherits AddinExpress.IE.ADXIEModule#Region " Component Designer generated code. "'Required by designerPrivate components As System.ComponentModel.IContainer'Required by designer - do not modify'the following methodPrivate Sub InitializeComponent()Me.components New uleName "MyIEAddon1"End Sub#End Region#Region " Add-in Express automatic code "'Required by Add-in Express - do not modify'the methods within this regionPublic Overrides Function GetContainer() AsSystem.ComponentModel.IContainerIf components Is Nothing Thencomponents New System.ComponentModel.ContainerEnd IfGetContainer componentsEnd Function ComRegisterFunctionAttribute() Public Shared Sub RegisterIEModule(ByVal t As nternal(t)End Sub ComUnregisterFunctionAttribute() Public Shared Sub UnregisterIEModule(ByVal t As Type)page 16

Add-in Express for IE and IEModuleInternal(t)End Sub ComVisible(True) Public Class IECustomContextMenuCommandsInherits dDispatcherEnd Class ComVisible(True) Public Class IECustomCommandsInherits End Class#End RegionPublic Sub New()MyBase.New()'This call is required by the Component DesignerInitializeComponent()End SubPublic Sub New(ByVal container As This call is required by the Component DesignerInitializeComponent()End SubPublic ReadOnly Property IEApp() As IE.WebBrowserGetReturn CType(Me.IEObj, IE.WebBrowser)End GetEnd PropertyPublic ReadOnly Property HTMLDocument() As mshtml.HTMLDocumentGetReturn CType(Me.HTMLDocumentObj, mshtml.HTMLDocument)End GetEnd PropertyEnd Classpage 17

Customizing the Internet Explorer UI at a GlanceAdd-in Express for IE and .NETCustomizing the Internet Explorer UI at a GlanceSee Custom Toolbar Buttons and Menu Items.See Custom Toolbars.See Adding a Custom Item to the Main Menupage 18

Customizing the Internet Explorer UI at a GlanceAdd-in Express for IE and .NETSee Custom Explorer BarsSee Custom Context Menu Commandspage 19

Add-in Express for IE and .NETCustom Toolbar Buttons and Menu ItemsCustom Toolbar Buttons and Menu ItemsComparing the WaysAdding a Toolbar Control onto the Command BarProviderIE6IE7IE8Other aspectsSeeIENoYesYesYou can add a button and/ormenu item. No dropdowns,toggle buttonsIE Command, AddingCustom Toolbar ButtonAdd-in ExpressNoYesThecontrolsaremappedto theToolsmenuButtons,buttonsAdding Custom Controls ontothe Standard IE Toolbardropdowns,toggleaAdding a Menu Item to the Main MenuWho providesIE6IE7IE8Other aspectsSeeIEYesYesYesYou can add a button and/ormenu item. No checked menuitems. No icons for menu items.IE Command, AddingCustom Menu ItemAdd-in ExpressYesYesYesIcons for menu items, checkedmenu itemsAdding Custom Controls ontothe Standard IE ToolbaraIE CommandA command is a custom button on its built-in toolbar called Command Bar (see the screenshot below) and/or acorresponding menu item on either of two IE menus: Tools and Help.page 20

Custom Toolbar Buttons and Menu ItemsAdd-in Express for IE and .NETTo create a new command, in the Properties window for the IEmodule, use the collection designer of the Commands property of themodule.IENote that Internet Explorer 6 supports adding custom items to theTools and Help menus only.Adding a Custom Toolbar ButtonIn the Commands property editor, you add an item and specify itsproperties. Note that every item allows creating a button and/or menuitem for the Help or Tools menu at the same time. To create acustom toolbar button (IE7 and IE8 only), make sure that theShowInToolbar property is set to true.The toolbar button must refer to two .ico files providing large and normal images for the active and default(inactive) button states (see Toolbar Button Style Guide on MSDN). Note that Add-in Express creates a newproject with two sample images. You can think of them as of placeholders. That is, you need to add your imagesto the resource file and specify them in appropriate properties of a command item.The DefaultVisible property specifies if the button appears on the Internet Explorer toolbar by default. If theuser has customized the toolbar, the button will not appear on the toolbar automatically. The toolbar button willbe added to the choices in the Customize Toolbar dialog box and will appear if the toolbar is reset.page 21

Custom Toolbar Buttons and Menu ItemsAdd-in Express for IE and .NETAdding a Custom Menu ItemYou use the item created in Adding a Custom Toolbar Button to add a custom menu item to the IE Help or Toolsmenu. To prevent showing the button in IE7 and IE8, set the ShowInToolbar property shown in the screenshotbelow to false.page 22

Custom Toolbar Buttons and Menu ItemsAdd-in Express for IE and .NETThe only property required to display a menu item is Caption. The HelpText property specifies a string shownin the Status Bar when you hover the mouse over the custom menu item (see below).It is not possible to show an icon for the menu item created by an IE command. But see Adding a Custom Itemto the Main Menu.Adding Custom Controls onto the Standard IE ToolbarIE7 and IE8 allow adding buttons only on the Command Bar toolbar. Add-in Express enables IE7 developers toshow buttons, toggle buttons and dropdowns on the toolbar (for IE8, see the note below). You choose the AddCommands command of the IE module in the context menu of its designer surface. This adds anpage 23

Custom Toolbar Buttons and Menu ItemsAdd-in Express for IE and .NETADXIECommands component to the module; you add your controls to the editor of its Controls collection (seethe screenshots below).You specify two ImageLists (just drop them onto the module) in the LargeImages and NormalImagesproperties of the ADXIECommands component. You can use any image formats in these ImageList

Add-in Express is developed and supported by the Add-in Express Team, a branch of Add-in Express Ltd. The Add-in Express web site at www.add-in-express.com provides a wealth of information and software downloads for Add-in Express developers, including the HOWTOs section with