G
Guest
I am using C#. I have a windows form with a button on it. When clicked, I want to run an application. I am using the ProcessStartInfo class and the Process.Start method. The .exe I am trying to run throws me a bunch of error messages when I try and start it using Process.Start. Here is the code
System.Environment.CurrentDirectory = node.Attributes["path"].Value; // (thought this may help, but didn't
ProcessStartInfo pi = new ProcessStartInfo()
pi.UseShellExecute = true
pi.FileName = ((Button)sender).Name; //Contains the .exe string (this is working correctly
pi.WorkingDirectory = node.Attributes["path"].Value; // (thought this may help, but didn't
pi.WindowStyle = ProcessWindowStyle.Maximized; // (tried with and without this line
Process p = Process.Start(pi)
p.WaitForExit(); // Again, tried with/without this (although I assume this shouldn't matter
Anyhoo - as you can see, there isn't anything fancy that I am trying to accomplish. All of my variables have been checked and they are returning exactly as expected - so it's something with the System.Diagnostics.Process and StartInfo class that is preventing my application from running properly
The .exe runs fine when I run it from Explorer. Is there another way to start an external program in my windows application besides Process.Start
I'm guessing it's a path issue, but I'm stumped at this point. Anyone?
Thanks much for the help, :
Rob
System.Environment.CurrentDirectory = node.Attributes["path"].Value; // (thought this may help, but didn't
ProcessStartInfo pi = new ProcessStartInfo()
pi.UseShellExecute = true
pi.FileName = ((Button)sender).Name; //Contains the .exe string (this is working correctly
pi.WorkingDirectory = node.Attributes["path"].Value; // (thought this may help, but didn't
pi.WindowStyle = ProcessWindowStyle.Maximized; // (tried with and without this line
Process p = Process.Start(pi)
p.WaitForExit(); // Again, tried with/without this (although I assume this shouldn't matter
Anyhoo - as you can see, there isn't anything fancy that I am trying to accomplish. All of my variables have been checked and they are returning exactly as expected - so it's something with the System.Diagnostics.Process and StartInfo class that is preventing my application from running properly
The .exe runs fine when I run it from Explorer. Is there another way to start an external program in my windows application besides Process.Start
I'm guessing it's a path issue, but I'm stumped at this point. Anyone?
Thanks much for the help, :
Rob