My product contains a suite of applications, some of which control instruments. If user tries to uninstall the product while any of the instrument control apps are running then I want to provide a message to the user to close those applications properly and then try to uninstall the product. I am doing this by adding a custom action that is triggered AFTER maintenance welcome dialog is displayed. The custom action calls a IS script function, which checks if the any of the apps are running and displays a proper message to the user. This works when user runs the setup.exe from the installation package. But if user tries to uninstall the product using the Add or Remove programs option in Windows Control Panel then the maintenance welcome page is not displayed and thus my custom action is not triggered. To handle this scenario I added another custom action that gets triggered AFTER CCPSearch action. In this custom action I called the same script function, which does not seem to work. Upon debugging I discovered that the path to the application's file name is wrong because the INSTALLDIR property is empty. I don't want to hard code the install location in the script.

Is there a way to get the install location when uninstall is triggered from Add or Remove option from control panel?