How to start the application when a Checkbox is ticked?
-
10 iulie 2008 15:33
I did the following actions:
1) I created a Launcher Class Library project and created an installer class in which I have overriden the Commit method of base installer as this:
public
override void Commit(System.Collections.IDictionary savedState){
base.Commit(savedState);System.Diagnostics.
Process.Start(Context.Parameters["TargetDir"] + "MyApplication.exe");}
2) A new dialog box containing a Checkbox created in the Setup Project/User Interface/End section before Finish dialog box
This checkbox, the property named CBLAUNCH, is responsible to specify whether to launch the application.
3) In the Custom Action view I have added a new custom action and its CustomActionData is /TargetDir="[TARGETDIR]\"
The problem is that the application is launched all the time after the installation no matter whether the checkbox is ticked.
My question is what should I write for the Condition property so that the MyApplication.exe gets run only when the Checkbox is checked?
"CBLAUNCH.Checked == true" doesn't work.
Where should I put my Launcher Dialogbox? currently it's in User Interface/ "End" phase and before "Finish" dialogbox
Should I put the Launch Condition in "Install" phase or "Commit"?
Toate mesajele
-
10 iulie 2008 17:20ModeratorThose properties have values of 0 or 1, so you'd say CHECKBOXA1=1 or in your case CBLAUNCH=1 .
-
11 iulie 2008 09:24
Thanks Phil
I tested it, when CBLUNCH=1 it launches the application, otherwise it doesn't. It only works with whatever has been specified at the design time by default not at run time.
But the problem I think is the location of Custom Action or the Dialog Box.
The Custom Action is under "Commit".
The dialog box, containing the checkbox, is under "End" step and before the "Finish" dialog box.
I think the location of these is incorrect, since the launch does not affect when whether the check box is ticked.
I can put the dialogbox under the "Start" phase, but it makes more sense if it can be put under "End" when the installation finished.
Also, the launch of the application I think is better to be done when all the installation dialog boxes finished, but not sure how to do it.
-
11 iulie 2008 19:44ModeratorYou cannot change that final dialog, so you can't add a checkbox to it. You might be able to add a checkbox dialog to just before the exit dialog - that might work, but I haven't tried it. It would at least be at the end of the install. Visual Studio setups don't oiffer dialog editing features, otherwise normally you'd add a checkbox and clicking finish would launch your custom action if the box was checked.
-
14 iulie 2008 10:58
Thanks Phil.
So, how do you customize all the installation dialog boxes if you want to?
Creating a custom installer application? -
14 iulie 2008 21:20Moderator
There are tools that let you have a custom dialog, such as the Completed dialog with a checkbox added, but they're only "custom" in the sense that Visual Studio is not one of the tools that lets you do that. InstallShield, Wise, WiX, Advanced Installer and others:
http://www.installsite.org/pages/en/msi/authoring.htm
have always let you have dialogs the way you want them. I don't mean Windows Forms or .NET, I mean the dialogs in the MSI file that are the ones shown by Windows Installer when it runs your MSI file. Visual Studio is basically a tool that will build a basic MSI setup, install files etc, but it doesn't offer support for all the features of Windows Installer - it doesn't compete with those other tools. So people that want to customize a setup beyond what Visual Studio can do just don't use Visual Studio to build their setup.
-
16 aprilie 2012 05:38
Those properties have values of 0 or 1, so you'd say CHECKBOXA1=1 or in your case CBLAUNCH=1 .
Hello Phil,
I have created a .msi file with some custom Dialogboxes. I have also included checkbox on my Dialogbox. Now I want to launch an msi file (immediately or after installtion ) when user click on checkbox. Please instruct me how to do this.
Thanks
Vivek Soni