Archive: Add/remove progrrams


Add/remove progrrams
NSIS newbie here -- I am using NSIS to deliver my app. I would like to have an entry in the add/remove programs window for my app. Right now I run the installer and it does not show up in add/remove.. How can I right this wrong?


In your installer, do this:
WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\YourProductHere" "DisplayName" "Your Product"

WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\YourProductHere" "UninstallString" "uninst.exe"

The first is the text displayed in the Add/Remove dialog, the 2nd is the command line to execute.


You can do a much better job than just set up the basic items, I have extracted some code out of my header (this will add "support information" with web links etc - formatting stuffed up):

;--- Set up the uninstall (and add/remove program) Information --------------
<$NsisCmt "Specify ADD/REMOVE Programs Info">
<$WriteReg SUBKEY="<$MachKeyUninstall>" KEY="UninstallString" VALUE="<$UninstallEXEThere>">
<$WriteReg SUBKEY="<$MachKeyUninstall>" KEY="DisplayName" VALUE="<$DisplayName>">
<$WriteReg SUBKEY="<$MachKeyUninstall>" KEY="DisplayIcon" VALUE="<$UninstallIcon>">
<$WriteReg SUBKEY="<$MachKeyUninstall>" KEY="DisplayVersion" VALUE="<$ProductVersion> (<$PackagedWhen>)">
#ifdef HelpLink
<$WriteReg SUBKEY="<$MachKeyUninstall>" KEY="HelpLink" VALUE="<$HelpLink>">
#endif
#ifdef Publisher
<$WriteReg SUBKEY="<$MachKeyUninstall>" KEY="Publisher" VALUE="<$Publisher>">
#endif
#ifdef Comments
#RexxVar RxComments = ^<$Comments>^
#DefineRexx ''
;--- Work around Windows bug #1,456,321 ------------------------------
RxComments = ReplaceString(RxComments, '"', "'");
#DefineRexx
<$WriteReg SUBKEY="<$MachKeyUninstall>" KEY="Comments" VALUE="<??RxComments>">
#endif
#ifndef NSIS_NO_README
;--- If local readme exists assume it will in the "INSTDIR" as well ------
#define? ReadmeFileHere <$ProductName>.txt
#define? ReadmeFileThere $INSTDIR\<$ReadmeFileHere>
<$NsisCmt "Want the readme in the package">
#DependsOn INPUT "<$ReadmeFileHere>"
<$FILE "<$ReadmeFileHere>">

;--- Add to Uninstall Information ----------------------------------------
#ifndef NSIS_NO_README_IN_ADD_REMOVE
#DefineRexx ''
ArFile = ReplaceString('<$ReadmeFileThere>', ':', '|');
ArFile = 'file:///' || ArFile;
#DefineRexx
<$WriteReg SUBKEY="<$MachKeyUninstall>" KEY="Readme" VALUE="<??ArFile>">
#endif


There are some other keys but from what I can see of limited use.


awesome!

Originally posted by mgentry
In your installer, do this:
WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\YourProductHere" "DisplayName" "Your Product"

WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\YourProductHere" "UninstallString" "uninst.exe"

The first is the text displayed in the Add/Remove dialog, the 2nd is the command line to execute.
Thanks, these few lines helped me achieve the one thing I didn't like bout my installer.