Is this the best way to see if a DOS executable is running? I tried
getting process window titles but it takes longer and the window title
could be any number of different names. I'm a little worried about my
program corrupting the executable using the code below. Or should I not
worry? The DOS app is operation critical.
'Make sure that PTE isn't running before we continue.
Dim PTE As String = "d:\apps\pte\ptec.exe"
Try
Dim fi As New FileInfo(PTE)
Dim sr As Stream = fi.Open(FileMode.Open, _
FileAccess.Read, FileShare.None)
sr.Close()
Catch ex As Exception
Console.WriteLine(vbCrLf & _
"PTE is currently running. You must close PTE before using this
program." & _
vbCrLf)
Exit Sub
End Try
*** Sent via Developersdex http://www.developersdex.com ***