Archive: Registering a DLL with RegServ32


Registering a DLL with RegServ32
I need to register a right click contextual menu extension when users install my applicaion. Questions:

1) How can I register upon installation?
2) How can I unregister upon un-installation?

To register the file, simply select the appropriate version of the DLL (remember that Unicode builds will not work correctly on Win95/98), copy it to an appropriate location (Windows System Directory recommended), and run "RegSvr32 CopyPathExt.dll" from the command line. The item "Copy Path to Clipboard" will now appear when you right-click on files or directories!

Thanks very much!
chasetoys


You have several options... For installation:

ExecWait '$SYSDIR\regsvr32.exe /s "<your_path>\<your_dll>"'
and for uninstalling:
ExecWait '$SYSDIR\regsvr32.exe /u /s "<your_path>\<your_dll>"'
Or you can use RegDLL:
SetOutPath <your_path>
RegDLL "<your_path>\<your_dll>"
and to uninstall:
SetOutPath <your_path>
UnRegDLL "<your_path>\<your_dll>"

CF

Make sure you use RegDLL and UnRegDLL because the regsvr32 executable is not on all Windows platforms.

-Stu


Better still use the InstallLib

...

!Include "Library.nsh"

...

!insertmacro InstallLib REGDLLTLB NOTSHARED REBOOT_NOTPROTECTED "c:\whereveryouroriginalfileis\yourfile.dll" "$INSTDIR\yourfile.dll" "$SYSDIR"

and do not forget to un-register at un-install...

..!insertmacro unInstallLib etc. etc.

See manual.


Is it still better to use the InstallLib? If yes: Why?

Thanks :)

CJ


InstallLib has more features and is more flexible. E.g. If you need to replace / register a dll that is on use while you install, InstallLib can do it automatically on reboot.

If you don't ever need to register files that may be on use and you only register your own files then RegDLL and UnRegDLL should work just fine.

PaR


So far, I just need to (un)register my own files.

Thank you, PaR. :)

CJ


I'm kind of confused right now, because I don't know why RegDLL fails.
Do I need admin rights do register a simple OCX file?


RegDLL "mydir\myOCX.ocx"

Probably. You could of course find that out simply by trying it...