This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: How to restart Window service AFTER user "cancels" during install??
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Jun 09, 2006
01:04 PM
How to restart Window service AFTER user "cancels" during install??
During my install, I shutdown a particular window's service. This works fine. However, if the user cancels from the installation, I would like a chance to restart the service that I earlier shutdown. There is no onCancelling even that gets fired for the install (IS11.5MP Windows). I looked at putting some code in the Cancel Frame dialog's clicked event, but once the wizardUI.doCancel(); executes, there user was already presented with a Yes/No cancel dialog and it seems like I cant execute any useful code after this - I get an illegal state exception saying the wizardservice is already shutdown
Any ideas on how to restart a windows service once the user says "Yes" to the Are you sure you want to cancel the install?
Thanks!
Any ideas on how to restart a windows service once the user says "Yes" to the Are you sure you want to cancel the install?
Thanks!
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Jun 12, 2006
01:58 PM
If the cancelation by the user occurs during the progress bar, then you can use a custom product action to detect the cancelation and take appropriate action. If a component's Install Failure option is set to Cancel & Rollback, then each product action in the component is uninstalled when the user cancels the install. Thus you could stop your service in the uninstall() method of a custom product action. The only trick is to detect that the user canceled rather than ran the uninstall normally. To do this, you get the OperationState for the product action and call isCanceled(). Here is some code that does this as an example:
Note that this will only work if the user cancels the install during the progress bar. On any panel in the post-install sequence, it is too late--they must run the separate uninstaller.
import com.installshield.product.ProductAction;
import com.installshield.product.ProductActionSupport;
import com.installshield.product.ProductException;
import javax.swing.*;
public class RollbackAction extends ProductAction {
/* (non-Javadoc)
* @see com.installshield.product.ProductAction#uninstall(com.installshield.product.ProductActionSupport)
*/
public void uninstall(ProductActionSupport support) throws ProductException {
if (support.getOperationState().isCanceled()) {
JOptionPane.showMessageDialog(null, "Rolling back action "+getBeanId());
// Do Rollback here
}
else {
JOptionPane.showMessageDialog(null, "Uninstalling action "+getBeanId()+ " normally.");
// Normal uninstall here or more likely no-op
}
}
}
Note that this will only work if the user cancels the install during the progress bar. On any panel in the post-install sequence, it is too late--they must run the separate uninstaller.
![](/skins/images/A5EADE085F77DE82FB3B14D6B307AE6A/responsive_peak/images/icon_anonymous_message.png)