vb 调用exe 程序结束后再继续
我想用shell语句调用exe文件,外部exe文件运行结束后会生成一个TXT文件,所以需要该程序结束后再运行下面的代码。callshell(“d:\test3\selec...
我想用shell语句调用exe文件,外部exe文件运行结束后会生成一个TXT文件,所以需要该程序结束后再运行下面的代码。
call shell(“d:\test3\select.exe",vbhide)
求救。 展开
call shell(“d:\test3\select.exe",vbhide)
求救。 展开
展开全部
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Sub Form_Load()
Dim lngPId As Long
Dim lngPHandle As Long
lngPId = Shell("Notepad.exe", vbNormalFocus)
lngPHandle = OpenProcess(SYNCHRONIZE, 0, lngPId)
If lngPHandle = 0 Then
Call WaitForSingleObject(lngPHandle, INFINITE) ' 无限等待, 直到程式结束
Call CloseHandle(lngPHandle)
End If
Call Shell("d:\test3\select.exe", vbHide)
End Sub
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Sub Form_Load()
Dim lngPId As Long
Dim lngPHandle As Long
lngPId = Shell("Notepad.exe", vbNormalFocus)
lngPHandle = OpenProcess(SYNCHRONIZE, 0, lngPId)
If lngPHandle = 0 Then
Call WaitForSingleObject(lngPHandle, INFINITE) ' 无限等待, 直到程式结束
Call CloseHandle(lngPHandle)
End If
Call Shell("d:\test3\select.exe", vbHide)
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询