Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Shell and Wait to complete


Message #1 by Terry.Arnett@r... on Mon, 5 Feb 2001 12:03:27 -0600
I found my example:

Const INFINITE = -1&

Private Declare Function WaitForSingleObject Lib "kernel32" _
                        (ByVal hHandle As Long, _
                        ByVal dwMilliseconds 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 Sub Form_Load()

'heres an example:

strBCPBatFile = "APPS\BCPTransferToMidWest.bat"

lngExecOK = Shell(strBCPBatFile, vbMinimizedNoFocus)
lProcessHandle = OpenProcess(&H100000, True, lngExecOK)
lReturnVal = WaitForSingleObject(lProcessHandle, INFINITE)

End Sub


hope this helps,

john
--- Terry.Arnett@r... wrote:
> Any ideas or examples on using the SHELL function and waiting for the
> script to complete, before returning control back to the calling VB
> program?
> 
> Thanks,
> Terry
> 

John Pirkey 
MCSD 
John@S... 
http://www.stlvbug.org

  Return to Index