Private Const CREATE_NO_WINDOW = &H8000000
Public Sub ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim START As STARTUPINFO
Dim ret As Long
' Initialize the STARTUPINFO structure:
START.cb = Len(START)
' Start the shelled application:
ret = CreateProcessA(&O0, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS + CREATE_NO_WINDOW, 0&, 0&, START, proc)
If ret Then
' Wait for the shelled application to finish:
ret = WaitForSingleObject(proc.hProcess, INFINITE)
End If
CloseHandle (proc.hProcess)
End Sub
Rob Lemieux heeft geschreven in bericht ...
In my code...
Dim intFNum As Integer
Dim ID As Integer
intFNum = FreeFile
Open "runme.bat" For Output As #intFNum
Print #intFNum, "dir > log.txt"
Close #intFNum
ID = Shell(fileName, vbNormalFocus)
I want to wait until the log.txt file is read for reading.
I don't want to specify a time, because some computers run very slow,
othersfast.
Thanks.