[英]starting external process when one process is done
Stupid question, but I am starting a couple external applications (all .exe)
. 愚蠢的问题,但我正在启动几个外部应用程序
(all .exe)
。 After the process is started, how can I make my program wait until that process ends to start another process? 该过程开始后,如何让我的程序等到该过程结束以启动另一个过程?
Example' 例'
'Start application
Process.Start(My.Computer.FileSystem.CurrentDirectory & "SomeEXE1.exe")
**' A if statement or something to state that SomeEXE2.exe will NOT start until SomeEXE1.exe finish.**
Process.Start(My.Computer.FileSystem.CurrentDirectory & "SomeEXE2.exe")
Just call: 只需致电:
Process.WaitForExit
on that instance of Process
. 在那个
Process
实例上。
How about using Shell? 使用Shell怎么样?
Dim pID As Integer = Shell(thePathOfEXE, AppWinStyle.NormalFocus, True, 30000) DIM pID As Integer = Shell(thePathOfEXE,AppWinStyle.NormalFocus,True,30000)
Will launch the exe passing the processID back to pID, normal focus and wait until completed execution or until 30 seconds have passed. 将启动exe将processID传递回pID,正常焦点并等待完成执行或直到30秒过去。 The 30000 could be -1 if you're not interested in a timeout.
如果你对超时不感兴趣,30000可能是-1。
http://msdn.microsoft.com/en-us/library/xe736fyk(v=vs.71).aspx http://msdn.microsoft.com/en-us/library/xe736fyk(v=vs.71).aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.