Click to See Complete Forum and Search --> : Waiting untill a function ends


dammansky
March 28th, 2001, 07:38 AM
hi,

i have a program in which i have to send several mails. so i have a for loop with the function "send". Now i would like to say that the loop has to wait untill the previous send has finished. Can i do this.

In other words is there an opposit function to DoEvents?

Thanx

Cubbie
March 28th, 2001, 08:04 AM
Try the following API's:

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 Const SYNCHRONIZE = &H100000
private Const INFINITE = &HFFFF

Iouri
March 28th, 2001, 08:19 AM
Function MyFunc()
Dim myObject As Object
Dim RetVal As Variant

Set myObject = CreateObject("WScript.Shell")
RetVal = myObject.Run("c:\windows\notepad.exe", 1, True)
MsgBox "Notepad is closed"

End Function


'TRue - wait until proc is over
'False don't wait

Iouri Boutchkine
iouri@hotsheet.com