I am creating a process to do some working. But the process is starting a black window (like the cmd). I have tried to set the CreateNoWindow = true but that doesn't help.
Is there another way to disallow window creation?
Here is my code:
var worker1 = new Process();
worker1.EnableRaisingEvents = true;
worker1.StartInfo.CreateNoWindow = true;
worker1.StartInfo.ErrorDialog = true;
worker1.StartInfo.Arguments = job.BtcFilePath;
worker1.StartInfo.FileName = job.ExeFilePath;
worker1.Exited += new EventHandler(Worker1Exited);
Processors.Add(worker1);
Processors.Last().Start();
Processors.Last().PriorityClass = ProcessPriorityClass.BelowNormal;
*The Processors is a list of processors
BR
worker1.StartInfo.CreateNoWindow = true;
worker1.StartInfo.UseShellExecute = false;
This worked for me in a similar situation.
worker1.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
This seems to be another option. (Did not test this, but found this while browsing http://www.dotnetperls.com/png)
true if the shell should be used when starting the process; false if the process should be created directly from the executable file. The default is true.
- The shell manages all windows (I assume it does anyway,) so not using the shell will stop the window from being created - Thomas 2012-04-04 08:27