wiseindian
New member
- Joined
- Aug 21, 2013
- Messages
- 2
- Programming Experience
- Beginner
I have to kill a process (an exe file) that does not have a distinctive name. All I know are the first two chars of its name for eg "3D". I have tried to use wildcards (3d*) but these do not work.
I have managed to verify that the process is running but I can't figure out how to search through the processes and then kill the process which begins with "3D".
Here si my code:
'-- get a collection of processes running
Dim nameProcess() As System.Diagnostics.Process = System.Diagnostics.Process.GetProcesses
For Each p As Process In Process.GetProcesses()
Debug.WriteLine(p.ProcessName)
Next
' this is the process check function
threeD = 3D 'I have declared this as string before in the code
If IsProcessRunning(threeD) = True Then
MsgBox("3D Found")
End If
I also used this to loop through the processes but the wild card does not work:
Dim proc() As Process = Process.GetProcessesByName("3D*")
For Each temp As Process In proc
temp.Kill()
Next
I have managed to verify that the process is running but I can't figure out how to search through the processes and then kill the process which begins with "3D".
Here si my code:
'-- get a collection of processes running
Dim nameProcess() As System.Diagnostics.Process = System.Diagnostics.Process.GetProcesses
For Each p As Process In Process.GetProcesses()
Debug.WriteLine(p.ProcessName)
Next
' this is the process check function
threeD = 3D 'I have declared this as string before in the code
If IsProcessRunning(threeD) = True Then
MsgBox("3D Found")
End If
I also used this to loop through the processes but the wild card does not work:
Dim proc() As Process = Process.GetProcessesByName("3D*")
For Each temp As Process In proc
temp.Kill()
Next