I’ve written a C# application which uses System.Diagnostics.Process class to create a process, using
Process P1 = new Process(); P1.FileName = 'myexe.exe';
and other proper settings.
I’ve linked it to an exe file which runs for about 10 minutes. (I’m writing program to measure run-time of programs). Now in between I want to abort the running process. So I wrote in the cancel button’s event,
Process.Close();
But in the task manager I still see myexe.exe running, it doesn’t get aborted. What to do?
Process.Close() isn’t meant to abort the process – it’s just meant to release your ‘local’ view on the process, and associated resources.
I think you mean Process.Kill() or Process.CloseMainWindow(). Personally I’d try to find a more graceful way of shutting it down though.