Wait until the process has exited using Process.HasExited or Process.WaitForExit?

  • Thread starter Thread starter gaxjyxq
  • Start date Start date
G

gaxjyxq

Guest
I want to wait for a process exited, use Process.HasExited or Process.WaitForExit? what different for two functions?

Dim p As New Process
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
p.StartInfo.FileName = "test.exe"

p.Start()

Do Until p.HasExited = True Or use p.WaitForExit()
Threading.Thread.Sleep(100)
Loop

If p.ExitCode = 0 Then
Return True
Else
Return False
End If

Continue reading...
 
Back
Top