Closing the curent process
-
Hi I used the following code to close the running processes.When i click on the stop button i want to stop all those files that are opened.<pre> currpro = Process.GetCurrentProcess(); foreach (Process proce in currpro) { proce.CloseMainWindow(); }It says, Error 1 foreach statement cannot operate on variables of type 'System.Diagnostics.Process' because 'System.Diagnostics.Process' does not contain a public definition for 'GetEnumerator'
-
Hi I used the following code to close the running processes.When i click on the stop button i want to stop all those files that are opened.<pre> currpro = Process.GetCurrentProcess(); foreach (Process proce in currpro) { proce.CloseMainWindow(); }It says, Error 1 foreach statement cannot operate on variables of type 'System.Diagnostics.Process' because 'System.Diagnostics.Process' does not contain a public definition for 'GetEnumerator'
System.Diagnostics.Process.GetCurrentProcess() IS USED FOR GETTING CURRENT PROCESS. AND Process.kill() IS USED FOR KILLING PROCESS.
mailto: anubhava.prodata@gmail.com
-
Hi I used the following code to close the running processes.When i click on the stop button i want to stop all those files that are opened.<pre> currpro = Process.GetCurrentProcess(); foreach (Process proce in currpro) { proce.CloseMainWindow(); }It says, Error 1 foreach statement cannot operate on variables of type 'System.Diagnostics.Process' because 'System.Diagnostics.Process' does not contain a public definition for 'GetEnumerator'
MSDN on Process.GetCurrentProcess() says: Gets a new Process component and associates it with the currently active process. I can see no plural form anywhere, so why use
foreach
? :)