Peter350
Posts: 30
Joined: Sat Oct 17, 2009 1:56 pm

Detecting Uninstallation mode in InstallExecute?

I have custom action VBS scripts running under InstallExecuteSequence->InstallExecute

They are to remove files and folders left behind by the application. (Configuration files).

I need to allow the user the option to either execute these scripts, or not, upon uninstall.

For uninstallation by simply re-executing the Installer file, this is simple. I simply add a checkBox called CHECKBOX_REMOVE_CONFIGURATION_FILES to VerifyRemoveDialog, with a value of 1, then in my Custom Action I use the condition:

(REMOVE="ALL") AND (CHECKBOX_REMOVE_CONFIGURATION_FILES="1")

The issue is how to replicate this behaviour when the msi is started with msiexec /x from the Control Panel Programs page or by command line.

I have for testing inserted a MessageBox into InstallExecute which can display YES/NO with the same option to delete configuration files, and set another property I can test.

The issue is, how can that messagebox possibly determine whether 1. The MSI was ran from msi.exe /x (no UI) when I DO want the messagebox to show, or (2) whether the installer has already displayed VerifyRemoveDialog (when I do NOT want the messagebox to show)

In other words, how is it possible to determine in InstallExecute whether or not the UI particularly the VerifyRemoveDialog has been shown?
Bogdan
Posts: 2794
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Detecting Uninstallation mode in InstallExecute?

Hi,

This is very simple all you need to do is to test the value of the property UILevel, which tell us if the package is running with basic, silent or full UI.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Peter350
Posts: 30
Joined: Sat Oct 17, 2009 1:56 pm

Re: Detecting Uninstallation mode in InstallExecute?

Hi yes it does. UILevel is 5 when launched directly, or 3 when launched with msiexec.exe /x (as is done by the add/remove programs tab in Control Panel).

When UILevel is 5, we show a checkbox on VerifyRemoveDlg called "Remove Configuration Data".

When UILevel is 3, however, all we have at the moment as an option to gather further user input, is to use the MessageBox as a custom action under InstallExecute to provide a Yes/No choice to remove config files.

This is inconsistent. We wish to display the VerifyRemoveDlg when uninstalling from Control Panel.

Is there any way to switch the level from 3 to 5 or show other UI when the level is 3?


Also, when right-clicking on the apps in Programs & Features (Win7) The results can be:

Uninstall

Uninstall/Change

or a 3-item menu: "Uninstall, Change, Repair"

Some apps eg. vuze offer Uninstall/Change on right-click and show UI.

In Advanced installer I can generate a Change item by ensuring Disable Modify is not checked in Product Details.

But how can I display "Uninstall/Change" on the same menu line and show UI every time?
octavian.vasilovici
Posts: 51
Joined: Tue Jan 25, 2011 2:43 pm

Re: Detecting Uninstallation mode in InstallExecute?

Hello,

Unfortunately you can not display "Uninstall/Change" on the same menu line as this is controlled by Windows Installer and not Advanced Installer. Windows Installer supports creating three buttons "Change", "Repair", "Uninstall". By using the "Disable Repair" and "Disable Remove" , only the "Change" button will be displayed in Control Panel. This way the user can modify and uninstall the product by displaying the interface every time.


Best Regards,
Octavian
_______________________________________________________________________________________________________________________________________________
Octavian Vasilovici
Advanced Installer Team
http://www.advancedinstaller.com/
Octavian Vasilovici - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Peter350
Posts: 30
Joined: Sat Oct 17, 2009 1:56 pm

Re: Detecting Uninstallation mode in InstallExecute?

Right clicking on the installations of Windows Live Essentials 2001, or Notepad++

In programs & features

Shows one line:


Uninstall/Change
octavian.vasilovici
Posts: 51
Joined: Tue Jan 25, 2011 2:43 pm

Re: Detecting Uninstallation mode in InstallExecute?

Hello,

According to MSDN there is no way of changing the display strings of the "Repair, Change, Uninstall" buttons that appear in Control Panel. More information can be found on the MSDN website: Configuring Add/Remove Programs with Windows Installer.
Advanced Installer has no control on the display string of those buttons. As you can see from the link above, it simply controls the Windows Installer properties attached to each button.

As for Notepad++, it is not handled by Windows Installer when it is uninstalled. It uses a custom "uninstall.exe" file. Windows Installer standard dictates that those 3 buttons should appear in Control Panel. Everything else is custom behaviour.

Best Regards,
Octavian
_______________________________________________________________________________________________________________________________________________
Octavian Vasilovici
Advanced Installer Team
http://www.advancedinstaller.com/
Octavian Vasilovici - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
octavian.vasilovici
Posts: 51
Joined: Tue Jan 25, 2011 2:43 pm

Re: Detecting Uninstallation mode in InstallExecute?

Hello,

After some more research, I found the exact way on how to display the "Uninstall/Change" button for an installer in Add/Remove Programs Window from Control Panel. Please note, that this is a custom behaviour like stated earlier.

The following steps must be taken in Advanced Installer in order to achieve this behaviour:

- In "Product Details" Page check the "Disable Modify, Disable Repair, Disable Remove, Do not show in list" checkboxes.
- In "Registry" Page add the following registry keys under "Current user/Local machine" hive:

Code: Select all

Software\Microsoft\Windows\CurrentVersion\Uninstall\MyApplication
where MyApplication is the Product Name you assigned for the project in the "Product Details" Page.
- In MyApplication registry key add the following registry values:

Code: Select all

Name                        Type                    Data
------------------------------------------------------------------------------------------------------
DisplayIcon              REG_SZ                 [SystemFolder]msiexec.exe
DisplayName              REG_SZ                 [ProductName]
HelpLink                 REG_SZ                 [ARPHELPLINK]
InstallLocation          REG_SZ                 [APPDIR]
Publisher                REG_SZ                 [Manufacturer]
UninstallPath            REG_SZ                 [SystemFolder]msiexec.exe /i [ProductCode]
UninstallString          REG_SZ                 [SystemFolder]msiexec.exe /i [ProductCode]
URLUpdateInfo            REG_SZ                 [ARPURLINFOABOUT]
Version                  REG_SZ                 [ProductVersion]
Language                 REG_DWORD              [ProductLanguage]
- Add the application files, build and run the package.

If you have any other questions, please don't hesitate to contact us.

Best Regards,
Octavian
_______________________________________________________________________________________________________________________________________________
Octavian Vasilovici
Advanced Installer Team
http://www.advancedinstaller.com/
Octavian Vasilovici - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”