tags:

views:

36

answers:

1

I have an IE BHO which I was packaging through the Visual Studio setup and deployment project. I now want to the package it through an NSIS installer.

My BHO was registering in the following way:

    [ComRegisterFunctionAttribute]
    public static void Register(Type t)
    {
        string guid = t.GUID.ToString("B");

        RegistryKey rkClass = Registry.ClassesRoot.CreateSubKey(@"CLSID\"+guid );
        RegistryKey rkCat = rkClass.CreateSubKey("Implemented Categories");

        string name = toolbarName;
        string help = toolbarHelpText;

        rkClass.SetValue(null, name );
        rkClass.SetValue("MenuText", name );
        rkClass.SetValue("HelpText", help );

        if( 0 != (style & BandObjectStyle.Vertical) )
            rkCat.CreateSubKey("{00021493-0000-0000-C000-000000000046}");

        if( 0 != (style & BandObjectStyle.Horizontal) )
            rkCat.CreateSubKey("{00021494-0000-0000-C000-000000000046}");

        if( 0 != (style & BandObjectStyle.TaskbarToolBar) )
            rkCat.CreateSubKey("{00021492-0000-0000-C000-000000000046}");

        if( 0 != (style & BandObjectStyle.ExplorerToolbar) )
            Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Toolbar").SetValue(guid,name);

    }

While this is taken care of by the msi installer that is made by VS, I want to know how can I do the same using NSIS?

Any help would be appreciated!

Kapil

A: 

You must explicitly call regsvr32.exe during both installation (to register) and removal (to unregister).

e.g. during installation:

Exec 'regsvr32.exe /s "$INSTDIR\your_bho.dll"'

...and during removal:

 Exec 'regsvr32.exe /s /u "$INSTDIR\your_bho.dll"'

...where your_bho.dll is the filename for your BHO. The /s flag, btw, inhibits the command from displaying a dialog to your end-user. regsvr32.exe is in the system32 directory, so you don't need to worry about the path to it.

Phil Booth