Archive: Add/Remove Program List Updating


Add/Remove Program List Updating
After running the uninstaller, the add/remove program list doesn't update automatically (at least on the one machine I've been testing with so far). From what I've read online, the add/remove list updates right after the uninstall process (spawned by it) exits. From what I've read about NSIS, it copies the uninstaller to a temp directory to simplify deletion of the uninstaller. I'm guessing that a new process is created with the new uninstall.exe image as I've observed that the add/remove program list refreshes right when the uninstall GUI comes up. Questions:

1. Is there a way to get the add/remove program list updated after the uninstaller finishes? Is this being planned?

2. Does anyone have suggestions on how to clearly explain this to the user? I've added a follow-up window (that comes up after pressing "Finish") that tells the user to close and re-open the add/remove program window if the list doesn't automatically refresh. This seems a bit excessive, but I couldn't squeeze the text in the subtitle area. If the user tries to uninstall the program again, Windows tells the user that an error occurred while trying to uninstall my program... A carefully worded phrase might be of general use. Comments?


Hmm, not sure.

-Stu


I don't know. I think you actually have refresh the registry and not
the add/remove.
As you know, you put a string in the registry so the user
can apply there. So for this, you have to refresh the
registry; so add/remove re-search for the current strings to be
uninstall.


Thanks for the comments Stu and Lobo Lunar. I now see that I should have been clearer in my post. Clarifications:

1. I think the initial process (that copies uninstall.exe) terminates just after creating the new process with the new image of uninstall.exe.

2. I do update the registry when my program is installed and when it is uninstalled.

During the install:


WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "DisplayName" "${MUI_PRODUCT}"
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "NoModify" 1
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "NoRepair" 1


During the uninstall:

DeleteRegKey /ifempty HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}"


This part all seems fine as my program shows up in the list after installing and does not show up in new add/remove program windows after uninstalling. (Just the already-present add/remove program window which I use to initiate the uninstall.)

I can see the add/remove program list being refreshed just after the uninstaller starts.

Since starting this post, I've changed ${MUI_PRODUCT} to PSI-${MUI_PRODUCT} in my installer, to reduce collisions.

The uninstaller forks another process so you can delete the uninstaller itself. The Add/Remove control panel only updates itself when the first process exits (Windows 9x only). We have yet to find a way to force it to reload.


I just ran into this problem too, and started looking for a solution, when I found this thread.

I just thought of a possible solution to this problem, although it does have another side effect.

The first uninstaller could remove the registry settings before forking and exiting. Then when it exits, it will be removed.

The forked uninstaller can then put them back if the uninstall is cancelled. So that you won't lose the settings.

Of course, it does give a new problem, because now, if you start the uninstaller from add/remove progams and then cancel it, it will not be in the list anymore and you need to reopen or refresh the list manually.

But perhaps this behaviour could be set with a flag?


Remco


When I have add/remove programs open and install my product it doesn't get refreshed. However, when I have add/remove programs open and remove the product by clicking the remove button the list gets refreshed. I noticed one thing you were doing in your code, which you shouldn't do in this case, unless you have removed all the children first (ie: the value pairs or subkeys).

Change the following:

DeleteRegKey /ifempty HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}"

to:

DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}"