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 u开发者_如何转开发sing NSIS?
Any help would be appreciated!
Kapil
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.
Or you could use the NSIS registry plug-in, which gives you plenty of useful helper functions.
And use RegDLL for registering the DLL.
精彩评论