Monday, October 11, 2004

Getting the Running Process and to Kill a process

'The RunningPrcs array contains all the process in the m/c.

Dim RunningPrcs() As Diagnostics.Process
Dim Currprcs As Diagnostics.ProcessRunningPrcs = Diagnostics.Process.GetProcesses()

'The following code enumerates through all the processes and kills a particular 'process based on a condn.

For Each Currprcs In RunningPrcs
If Currprcs.ProcessName = "YOUR PROCESS"
Then
Currprcs.Kill()
End If
Next

For more info check this link in ms site
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdiagnosticsprocessclassgetprocessestopic2.asp

No comments: