How to check whether a System.Diagnostics.Process is started?

cjard

Well-known member
Joined
Apr 25, 2006
Messages
7,081
Programming Experience
10+
Hi guys

I can create a S.D.Process object and name the exe to which it refers, set the rest of the start info etc.. But how can i check whether I actually started it or not?

calling mySDP.HasExited() when the process has been started, is fine.. But if I set all the info but dont start it, it throws an exception. Is that going to be the way to tell? Every property of a Process throws an exception if the process is populated with startable info but not yet started..

regards
Matt
 
here's how i keep track of the processes that i start:
VB.NET:
Private myPrc As System.Diagnostics.Process

Private Sub btnStartPrc_Click(...) Handles btnStartPrc.Click
  myPrc = System.Diagnostics.Process.Start("Name", "Args")
End Sub

Private Sub btnEndPrc_Click(...) Handles btnEndPrc.Click
  myPrc.Kill() 'Or something else
End Sub

for example
 
Back
Top