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
Registering a DLL with RegServ32
9 posts
You have several options... For installation:
and for uninstalling:ExecWait '$SYSDIR\regsvr32.exe /s "<your_path>\<your_dll>"'
Or you can use RegDLL:ExecWait '$SYSDIR\regsvr32.exe /u /s "<your_path>\<your_dll>"'
and to uninstall:SetOutPath <your_path>
RegDLL "<your_path>\<your_dll>"
CFSetOutPath <your_path>
UnRegDLL "<your_path>\<your_dll>"
Make sure you use RegDLL and UnRegDLL because the regsvr32 executable is not on all Windows platforms.
-Stu
-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.
...
!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
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
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
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?
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...