Click here to Skip to main content
11,581,982 members (75,174 online)
Click here to Skip to main content
Add your own
alternative version

Pretty IE Toolbar in C#

, 9 Sep 2008 CPOL 114.7K 4.1K 120
The article describes the work principles and ways of use of IEToolbarEngine. This is a toolbar for Internet Explorer, which has a reusable architecture.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Runtime.InteropServices;
using System.Reflection;
using System.IO;
using SHDocVw;
using Microsoft.Win32;

namespace IEToolbarEngine
{
    [RunInstaller (true)]
    public partial class IEToolbarInstaller : Installer
    {
        public IEToolbarInstaller ()
        {
            InitializeComponent ();
        }

        /// <summary>
        /// Installation
        /// </summary>
        public override void Install (System.Collections.IDictionary stateSaver)
        {
            base.Install (stateSaver);
            RegistrationServices regsrv = new RegistrationServices ();
            if (!regsrv.RegisterAssembly (this.GetType ().Assembly,
            AssemblyRegistrationFlags.SetCodeBase))
            {
                throw new InstallException ("Failed To Register for COM");
            }

            IEToolbarEngine.InstallationDate = DateTime.Now;
        }

        /// <summary>
        /// Deinstallation
        /// </summary>
        /// <param name="savedState"></param>
        public override void Uninstall (System.Collections.IDictionary savedState)
        {
            Assembly asm = Assembly.GetExecutingAssembly ();
            string fullName = asm.GetModules () [0].FullyQualifiedName;
            string dataFolder = IEToolbarEngine.DataFolder;
            try
            {
                Directory.Delete (dataFolder, true);
            }
            catch (Exception)
            {
                //System.Windows.Forms.MessageBox.Show (ex.Message);
            }

            try
            {
                Registry.LocalMachine.DeleteSubKeyTree (IEToolbarEngine.AppKey);
                Registry.CurrentUser.DeleteSubKeyTree(IEToolbarEngine.AppKey);
            }
            catch (Exception)
            {
            }

            base.Uninstall (savedState);
            RegistrationServices regsrv = new RegistrationServices ();
            if (!regsrv.UnregisterAssembly (this.GetType ().Assembly))
            {
                throw new InstallException ("Failed To Unregister for COM");
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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

Share

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.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150603.1 | Last Updated 9 Sep 2008
Article Copyright 2008 by Alexandr Golovanov
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid