Custom Uninstall option - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

ramit
Posts: 90
Joined: Thu Dec 18, 2008 11:51 am

Custom Uninstall option

Hi Cosmin,

In my installer I have 4 features.
I added uninstall option also in the installer.

While uninstalling all the features get uninstalled. I do not want that.
While user uninstall, it should ask for custom un-install. Where user can select individual feature to uninstall.

Is there any way to do that.

Please help.

Thanks,
Amit Rajput
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Custom Uninstall option

Hi Amit,

You can try using the guidelines from the Show a custom feature selection dialog how-to. For the custom checkboxes you can use the "uninstall" value instead of "install". Also, the VBScript code can be modified like this:

Code: Select all

' Set contants for the INSTALLSTATE_ABSENT and INSTALLSTATE_LOCAL feature states
Const msiInstallStateAbsent = 2
Const msiInstallStateLocal  = 3

' Set the install state of the feature with the identifier "Feature1"
If Session.Property("CHECK1") = "uninstall" Then 
  Session.FeatureRequestState("Feature1") = msiInstallStateAbsent
Else
  Session.FeatureRequestState("Feature1") = msiInstallStateLocal
End If
This way, when the checkbox of a feature is checked, the feature will be uninstalled instead of beind installed like in the how-to.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ramit
Posts: 90
Joined: Thu Dec 18, 2008 11:51 am

Re: Custom Uninstall option

Hi Cosmin,

Thanks for reply; however I am still having some confusion.

I tried the steps that you mentioned. But it will add a dialog that will be displayed whenever I install the application.

I am sorry for not to clearly define my problem. I am re-writing it.

In my installer I have 4 Features.

While installing, it is going good. Custom option is coming so that user can install required feature.

I add uninstall option [New Shortcut option in toolbar] also that will display in Program Files ->Myapplication ->Uninstall.

When I click on this option, it starts uninstalling complete application [similarly if I remove the application from control panel it starts uninstalling complete application].

I want to display custom option similarly as user will get if he click again on Exe that he installed. [please see the attached snapshot].

Thanks again.

Amit
Attachments
CustomUnInstall.JPG
CustomUnInstall.JPG (29 KiB) Viewed 5112 times
cyb
Posts: 43
Joined: Wed Apr 15, 2009 1:06 pm

Re: Custom Uninstall option

Hi Amit!

The reason that the dialog appears when you install the application is that you probably added your custom uninstall dialog under the "First time install" dialog tree in the "Dialogs" page. If you want it to appear only when you try to uninstall the application you must add it under the "Maintenance" dialog tree. After doing that, just modify the checkbuttons and the VBscript according to Cosmin's post above and that should do it.

Note that if you use an uninstall shortcut, by default, this shortcut will make a silent uninstall and it will not use your custom uninstall dialog. However, if you want to use the shortcut and also to show your custom dialog, when you create the shortcut, you'll have to change its argument from "/x [ProductCode]" to "/i [ProductCode]"

Best regards,
cyb
Cosmin Budrica
Advanced Installer Team
http://www.advancedinstaller.com/
ramit
Posts: 90
Joined: Thu Dec 18, 2008 11:51 am

Re: Custom Uninstall option

Sorry by mistake I added it here. It moved as new topic

Return to “Common Problems”