There are times when you want to display UI elements during an uninstall. When I say UI elements, I’m referring to dialog boxes and/or message boxes. Now, that’s your plan, but when you get into it, you find there are instances where this isn’t happening. Well, why not? I have been through this before and will tell you how to guarantee that UI elements are shown during an uninstall.
First off, let’s refresh our memory on how we uninstall a software product. To do this, we go to Add/Remove Programs (Programs and Features in later Windows versions), select the product from the list, and this is what we see:
Add/Remove Programs dialog showing choices available for a product
Here, we have selected SQL Server Native Client, and three choices are appearing, Uninstall, Change and Repair. You can uninstall this product in two ways. You can select Change, then in dialog that appears, select Remove. Or you can just select Uninstall.
If you select Change, then Remove, you will still get the UI sequence during the uninstall. Meaning, you will still see dialogs and message boxes.
If you select Uninstall, the Windows Installer will only perform the Execute sequence during the uninstall. Therefore, no UI elements will be shown.
Here’s a screenshot showing the Add or Remove Programs section in the General Information view of an InstallShield project:
The Add/Remove Programs section in the General Information view
To ensure that UI elements are available during an uninstall, you have to disable the Remove button in the InstallShield project. That way to uninstall, the user will be forced to choose Modify/Change in the dialog. When he does that, he will be then be presented with a dialog that has three choices Modify, Repair, and Remove. And when he selects Remove, he will see the UI elements you have set up.
That always works.