Reputation: 7577
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
Upvotes: 1
Views: 80
Reputation: 1321
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)
Upvotes: 3