Any tips on getting the cancel button working for a deferred custom action?
During our MSI uninstallation (full GUI mode), at the beginning of the uninstallation we call a deferred CA. When this CA is executing, if the user clicks the cancel button, the windows installer will pop up the dialog asking you if you want to really exit the (un)installation or resume. At this stage, if I click to cancel the installation, nothing happens, and after our CA completes and file removal starts, clicking on the cancel button again throughout the rest of the uninstallation had absolutely no effect… I checked our MSI package’s cancel dialog, the two buttons are returning the right events (Return, and Exit events).
My questions are
You should look at the return values from various MSI functions (such as MsiProcessMessage, you are sending progress messages aren't you?). You'll notice that there are return values that indicate the user has clicked cancel while your action was running. If this occurs, your CustomAction should bail and return ERROR_INSTALL_USEREXIT.
You can see examples how this is done in the WiX serverca CustomActions... they use the core OcaXXX functions that wrap the Msi APIs to correctly handle the user cancel case.
Thanks, that suggestion worked, I put in code to trap return codes from MsiProcessMessage() in the custom actions and return the userexit error if MsiProcessMessage() returned IDCANCEL.
Content credit also belongs to