|
-
July 13th, 2005, 06:25 PM
#1
Is this good programming?
Hello,
When I click a button in my form, the command prompt will run and then through it another application will run as well. The thing is, When I click the button again an error pops up!! you know that windows error that asks you if you wanna let MS know about it?
After some experiments, I dicoveered that the problem is happeneing because the process is not brought to end even though I was using CloseMainWindow(). So I decided to use kill(). Now it works fine no matter how many times I click on the button. Now, I was reading that thread and I got the feeling that using kill() is no good?
Does that mean that the following code is bad:
Code:
private void Button_Click(object sender, System.EventArgs e)
{
System.Diagnostics.Process prc = new System.Diagnostics.Process();
System.Diagnostics.ProcessWindowStyle.Hidden;
prc.StartInfo.FileName = "C:\\WINDOWS\\system32\\cmd.exe";
prc.StartInfo.Arguments = "/K C:\\guido2gif.exe";
prc.Start();
prc.Kill();
}
Sorry for the long email!
Ali
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|