cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tirtht
Level 4

Cancel button in SetupProgress dialog does not terminate installation process(Basic MSI project)

Problem:

Once “Install” button is clicked then clicking Cancel button in “Setup progress” screen does not terminate/interrupt installation process.

Description:

We are using Basic MSI project template (in InstallShield 2018 Professional Edition). We have few of C# managed custom actions invoked after clicking “Install” button.

Once installation is in progress, when we click on “Cancel” button in “Setup Progress” screen, it does not stop/terminate in-progress custom actions and so installation process does not terminate.

We have tried below options:

  1. Killing process on click of Cancel button in Ready To Install screen. However, it kills the setup but does not terminate the installation process.
  2. Setting a property to check if cancel button is pressed or not, but managed code custom action property does not get the latest value for that.
  3. Applying Kill process custom action or Error custom action on Cancel button, and it, too, does not terminate the installation process.

Is there any way we can stop/terminate the installation process on clicking the Cancel button while C# managed code custom action is being executed?

Labels (1)
0 Kudos
(2) Replies
banna_k
Revenera
Revenera

@tirtht :

To determine if the cancel button was clicked, you need to send progress bar update messages to Windows Installer using the MsiProcessMessage API. MsiProcessMessage will return IDCANCEL (if I remember correctly) if the cancel button has been clicked. Your custom action then needs to return ERROR_INSTALL_USEREXIT (and your custom action needs to be set to check the exit code) to allow the install to exit.

For more info, check the below thread:

https://community.flexera.com/t5/InstallShield-Forum/Force-cancel-during-custom-action/m-p/66005#M41778

 

0 Kudos

@banna_k 

Thanks for your suggestion. I tried with the approach you mentioned and found MsiProcessMessage method in Installshield.Interop.Msi dll(where it is named as ProcessMessage). I tried creating a custom action on cancel button which calls the ProcessMessage method with InstallMessage.Error parameter. However, it returns ID.NoAction instead of ID.Cancel(as per your suggestion). We also tried with other InstallMessage enum values(AbortRetryIgnore, CancelTryContinue, FatalExit), but all of them produced same results. Please find the attached POC for the same.

Morevover, we tried by directly returning ID.Cancel, without calling ProcessMessage() function, which returns code 2, but that, too, did not stop the installation process. We also tried by sending hard coded exit value 1602, which is the value for ERROR_INSTALL_USEREXIT, that you had suggested. But that also did not make any impact on existing installation.

Could you please go through the attached POC and suggest if we need to make any changes over there, or is there any other way to stop/terminate the installation process?

0 Kudos