To launch an application from my C# program, I have tried the solutions listed in the thread at the following link : Launching an application (.EXE) from C#? .
I am facing a puzzling situation : no new window shows during the time my program runs, so I opened the processes list hoping to get more info. Here is what happens : when I double click my executable (case 1 : not using the code to execute the app), 5 different processes bearing the same name but different PIDs are raised and if I close the app, all of them shut down too so here I assume that all of these should run for my app to launch correctly; on the other hand, whenever I use the program to launch the app, only one process is initiated and no window is displayed (this is not a matter of ProcessStartInfo since I made sure to change the parameters so that a new window is displayed if needed). Any idea as to why there are two different behaviors depending on whether I "double click" manually or launch through a C# instruction ? If it is an "argument matter" is there a way for me to get more intelligence about the arguments that are implicitly used when I double click (and do not provide with my script as for now) ?
Thanks !
Appendix :
C# code :
using System;
using System.Diagnostics;
using System.IO;
namespace GradeBook
{
class Program
{
static void Main(string[] args)
{
ProcessStartInfo start = new ProcessStartInfo();
start.Arguments = "";
Directory.SetCurrentDirectory("C:\\Users\\sthg\\AppData\\Local\\Programs\\sthg");
start.FileName = "myApp.exe";
start.WindowStyle = ProcessWindowStyle.Normal;
start.CreateNoWindow = false;
int exitCode;
using (Process proc = Process.Start(start))
{
proc.WaitForExit();
exitCode = proc.ExitCode;
}
}
}
}