How do I check if a process is running, by path?
I have an application which displays in a listbox a list of files(including the full path). How do I select all items from the listbox and terminate their processes by path ? (NOT by filename only)
I have the below code , which triggers an error and the application stops immediately: I have a button which the user clicks and triggers an timer event. I need to use a timer, because of the many files the listbox will have. (the items which will be terminated)
Timer code:
Thanks in advanceCode:For Each k In Listbox2.Items Dim path As String = k Dim matchingProcesses = New List(Of Process) For Each process As Process In Process.GetProcesses() For Each m As ProcessModule In process.Modules If String.Compare(m.FileName, Path, StringComparison.InvariantCultureIgnoreCase) = 0 Then matchingProcesses.Add(process) Exit For End If Next Next For Each p As Process In matchingProcesses p.Kill() Next




Reply With Quote
