Process.GetProcessesByName does not work as expected

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

Process.GetProcessesByName() is not giving the expected results. Here is a
sample code.

Dim TestProcess() As Process
Try
TestProcess= Process.GetProcessesByName("Test.exe")
If TestProcess.Length = 0 Then
MsgBox("Not running", MsgBoxStyle.OKOnly)
Else
MsgBox("Running", MsgBoxStyle.OKOnly)
End If
Catch ex As Exception
MsgBox("Error!")
End Try

"Not Running" is displayed, though Test.exe is running.

Would anybody be able to figure out why?

Thanks.
kd
 
Yes, get rid of the ".exe". and only use "Test". Not sure if
capitalization makes a difference, but I know that the file suffix is not
returned by the GetProcessesByName function.
 
Back
Top