Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7701639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:02:20+00:00 2026-05-31T23:02:20+00:00

I have developed my application in .Net and my installer is working fine. Now

  • 0

I have developed my application in .Net and my installer is working fine.

Now I want some more functionality like adding checkbox at the end of installer for launching the same aplication after clicking the finish button.

I have also implemented the step given here :How can I customize an MSI in the Visual Studio setup/deployment project? But not able to get the checkbox at the end.

Existing JScript is this:

   // EnableLaaunchApplication.js <msi-file>
   // Performs a post-build fixup of an msi to launch a specific file when the install has completed


   // Configurable values
   var checkboxChecked = true;          // Is the checkbox on the finished dialog checked by default?
   var checkboxText = "Launch [ProductName]";   // Text for the checkbox on the  finished dialog
   var filename = "FlashApp.exe";   // The name of the executable to launch - change this to match the file you want to launch at the end of your setup


   // Constant values from Windows Installer
   var msiOpenDatabaseModeTransact = 1;

   var msiViewModifyInsert         = 1
   var msiViewModifyUpdate         = 2
   var msiViewModifyAssign         = 3
   var msiViewModifyReplace        = 4
   var msiViewModifyDelete         = 6



   if (WScript.Arguments.Length != 1)
   {
    WScript.StdErr.WriteLine(WScript.ScriptName + " file");
        WScript.Quit(1);
   }

   var filespec = WScript.Arguments(0);
   var installer = WScript.CreateObject("WindowsInstaller.Installer");
   var database = installer.OpenDatabase(filespec, msiOpenDatabaseModeTransact);

   var sql
   var view
   var record

   try
   {
var fileId = FindFileIdentifier(database, filename);
if (!fileId)
    throw "Unable to find '" + filename + "' in File table";


WScript.Echo("Updating the Control table...");
// Modify the Control_Next of BannerBmp control to point to the new CheckBox
sql = "SELECT `Dialog_`, `Control`, `Type`, `X`, `Y`, `Width`, `Height`, `Attributes`, `Property`, `Text`, `Control_Next`, `Help` FROM `Control` WHERE `Dialog_`='FinishedForm' AND `Control`='BannerBmp'";
view = database.OpenView(sql);
view.Execute();
record = view.Fetch();
record.StringData(15) = "CheckboxLaunch";
view.Modify(msiViewModifyReplace, record);
view.Close();

// Resize the BodyText and BodyTextRemove controls to be reasonable
sql = "SELECT `Dialog_`, `Control`, `Type`, `X`, `Y`, `Width`, `Height`, `Attributes`, `Property`, `Text`, `Control_Next`, `Help` FROM `Control` WHERE `Dialog_`='FinishedForm' AND `Control`='BodyTextRemove'";
view = database.OpenView(sql);
view.Execute();
record = view.Fetch();
record.IntegerData(7) = 33;
view.Modify(msiViewModifyReplace, record);
view.Close();

sql = "SELECT `Dialog_`, `Control`, `Type`, `X`, `Y`, `Width`, `Height`, `Attributes`, `Property`, `Text`, `Control_Next`, `Help` FROM `Control` WHERE `Dialog_`='FinishedForm' AND `Control`='BodyText'";
view = database.OpenView(sql);
view.Execute();
record = view.Fetch();
record.IntegerData(7) = 33;
view.Modify(msiViewModifyReplace, record);
view.Close();

// Insert the new CheckBox control
sql = "INSERT INTO `Control` (`Dialog_`, `Control`, `Type`, `X`, `Y`, `Width`, `Height`, `Attributes`, `Property`, `Text`, `Control_Next`, `Help`) VALUES ('FinishedForm', 'CheckboxLaunch', 'CheckBox', '18', '117', '343', '12', '3', 'LAUNCHAPP', '{\\VSI_MS_Sans_Serif13.0_0_0}" + checkboxText + "', 'CloseButton', '|')";
view = database.OpenView(sql);
view.Execute();
view.Close();



WScript.Echo("Updating the ControlEvent table...");
// Modify the Order of the EndDialog event of the FinishedForm to 1
sql = "SELECT `Dialog_`, `Control_`, `Event`, `Argument`, `Condition`, `Ordering` FROM `ControlEvent` WHERE `Dialog_`='FinishedForm' AND `Event`='EndDialog'";
view = database.OpenView(sql);
view.Execute();
record = view.Fetch();
record.IntegerData(6) = 1;
view.Modify(msiViewModifyReplace, record);
view.Close();

// Insert the Event to launch the application
sql = "INSERT INTO `ControlEvent` (`Dialog_`, `Control_`, `Event`, `Argument`, `Condition`, `Ordering`) VALUES ('FinishedForm', 'CloseButton', 'DoAction', 'VSDCA_Launch', 'LAUNCHAPP=1', '0')";
view = database.OpenView(sql);
view.Execute();
view.Close();



WScript.Echo("Updating the CustomAction table...");
// Insert the custom action to launch the application when finished
sql = "INSERT INTO `CustomAction` (`Action`, `Type`, `Source`, `Target`) VALUES ('VSDCA_Launch', '210', '" + fileId + "', '')";
view = database.OpenView(sql);
view.Execute();
view.Close();



if (checkboxChecked)
{
    WScript.Echo("Updating the Property table...");
    // Set the default value of the CheckBox
    sql = "INSERT INTO `Property` (`Property`, `Value`) VALUES ('LAUNCHAPP', '1')";
    view = database.OpenView(sql);
    view.Execute();
    view.Close();
}



database.Commit();
    }
    catch(e)
    {
WScript.StdErr.WriteLine(e);
WScript.Quit(1);
    }



    function FindFileIdentifier(database, fileName)
    {
var sql
var view
var record

// First, try to find the exact file name
sql = "SELECT `File` FROM `File` WHERE `FileName`='" + fileName + "'";
view = database.OpenView(sql);
view.Execute();
record = view.Fetch();
if (record)
{
    var value = record.StringData(1);
    view.Close();
    return value;
}
view.Close();

// The file may be in SFN|LFN format.  Look for a filename in this case next
sql = "SELECT `File`, `FileName` FROM `File`";
view = database.OpenView(sql);
view.Execute();
record = view.Fetch();
while (record)
{
    if (StringEndsWith(record.StringData(2), "|" + fileName))
    {
        var value = record.StringData(1);
        view.Close();
        return value;
    }

    record = view.Fetch();
}
view.Close();

    }

    function StringEndsWith(str, value)
    {
if (str.length < value.length)
    return false;

return (str.indexOf(value, str.length - value.length) != -1);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:02:21+00:00Added an answer on May 31, 2026 at 11:02 pm

    You should be aware that Visual Studio setup projects are horrible in many ways. So much in fact that Microsoft has removed them from the Visual Studio 11 and encouraged users to use a free version of InstallShield called Limited Edition. ISLE supports adding a checkbox to the finish dialog to launch your application. Another possibility is to convert to Windows Installer XML. It all depends on your needs and how much time you want to invest in learning installers.

    Visual Studio Setup Projects hides so much of the underlying MSI that it’s very limiting. There are ways to hack it with post build SQL updates to the MSI but it’s really a pain in the rear and not a scalable solution.

    This kind of script is a worthless effort in my opinion. Let’s use an analogy. If you were using some implementation of a .NET langauge ( let’s call it Bb ) and you found out that it was lacking a bunch of CLR / .NET capabilities, would you use a postbuild to manipulate the IL in the resultant assemblies or would you just switch to a better CLR language like C#? It’s the same thing. Don’t manipulate the resultant MSI, switch to a better tool.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed a windows application using .net and crystal report.. Now I want
I have developed a windows application via .NET 3.5 and now I want to
I have developed a web application in asp.net in visual studio 2008. Its working
I have developed a WinForm Application with VB.Net (VS2010) having Office 2010 Professional Installed,
i have developed a web application asp.net C#. on a button click i am
I have developed a MVC web application with ASP.NET MVC and im just wondering
I have developed an ASP.NET MVC (version 2 RC) application with a ton of
I'm a little confused. We have developed an net 4.0 application. We use nhibernate
On Windows 7, VB.NET Express, I have developed a simple Forms application. I don't
I have a web application developed in ASP.NET 2.0, deployed in a data center.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.