Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public override void Install(IDictionary stateSaver)
{
   try
   {
       base.Install(stateSaver);
       FileInfo fileInfo = new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location);
       //Take custom action data values
       string sProgram = Context.Parameters["Run"];
       sProgram = Path.Combine(fileInfo.DirectoryName, sProgram);
       Trace.WriteLine("Install sProgram= " + sProgram);
       OpenWithStartInfo(sProgram);
   }
   catch (Exception exc)
   {
       Context.LogMessage(exc.ToString());
       throw;
   }
}


I have try to create setup project with custom dialog box. use below code but setup time find error parameter value null.may be Context.Parameters["Run"] is return null.how to solw.plz help

C#
void OpenWithStartInfo(string sProgram)
{
    ProcessStartInfo startInfo = new ProcessStartInfo(sProgram);
    
    startInfo.WindowStyle = ProcessWindowStyle.Maximized;
    string[] ExcludeKeys = new string[] { "run", "WaitForExit" };
    startInfo.Arguments = ContextParametersToCommandArguments(Context, ExcludeKeys);
    Trace.WriteLine("run the program " + sProgram + startInfo.Arguments);
    Process p = Process.Start(startInfo);
    ShowWindow(p.MainWindowHandle, WindowShowStyle.Show); //otherwise it is not activated 
    SetForegroundWindow(p.MainWindowHandle);
    BringWindowToTop(p.MainWindowHandle); //make sure the user will see the new window above of the setup.
    Trace.WriteLine("the program Responding= " + p.Responding);
    if ((Context.IsParameterTrue("WaitForExit")))
    {
        p.WaitForExit(); //have to hold the setup until the application is closed.
    }
}
Posted
Updated 25-Mar-15 5:10am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900