Vb Shell 打开程序 等待运行完毕后再继续

ExpandedBlockStart.gif 代码
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  Declare  Function  OpenProcess Lib  " kernel32 "  (ByVal dwDesiredAccess  As   Long , ByVal bInheritHandle  As   Long , ByVal dwProcessId  As   Long As   Long

Private   Const  INFINITE  =   - 1 &
Private   Const  SYNCHRONIZE  =   & H100000

Sub  GbossSetup()

          
' ''打开程序
             a  =  Shell(App.Path  &   " /GBoss_Key.exe " , vbNormalFocus)
             p 
=  OpenProcess(SYNCHRONIZE,  False , a)
             
' 等待目标进程退出再继续
             r  =  WaitForSingleObject(p, INFINITE)
             
While  r  >   0
                 DoEvents
             
Wend
             
' ''关闭进程
             r  =  CloseHandle(p)

End Sub

 

转载于:https://www.cnblogs.com/lano/archive/2009/12/09/1620093.html

你可能感兴趣的:(shell,c/c++)