How to hide the file which are opened by external .exe after running the .exe in background using process.start() RRS feed

  • Question

  • The main issue the when process start run CfgGen.exe in background it is opening the excel file. So i am loosing my control from the form until the .exe perfoms his process. If we close the excel file before complition it is not providing the output complete.


    1)I want to hide that excel file &

    2) Get the control of form back so if need i can kill the process.

    For this i am using two button one to run exe & second to kill the process....

    Process proc = new Process();
    proc.StartInfo.FileName = "../../bin/Debug/CfgGen.exe";
    proc.StartInfo.Arguments = ConfigInput.Text + " " + ConfigOutputFolder.Text ;
    proc.StartInfo.WorkingDirectory = Application.StartupPath;
    proc.StartInfo.UseShellExecute = false;
     proc.StartInfo.RedirectStandardOutput = true;
     proc.StartInfo.RedirectStandardError = true;
    proc.StartInfo.CreateNoWindow = true;
    proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
    while (!proc.HasExited)
    this.ConfigOutputBox.Text +=proc.StandardOutput.ReadToEnd();
    this.Configuration .Focus ();
    this.ConfigOutputBox.Text += "Completed";

    Wednesday, July 15, 2015 1:00 PM