wford
asked on
DOS Doevents
We want to run a DOS program, which is run using shell.
The Dos program takes about a minute or so to process, at the end of this DOS process, we want the VB function to continue on to the next line.
We have other processes running at the same time both on the computer and in the VB application, and need them to keep running while this process is doing its work.
we cannot edit the DOS program, but have a batch file which runs it.
So we need the code that goes here
private sub fn_shell()
n = Shell(MyBatchFileName)
....
....
'process to be done AFTER the Dos Process is Done
call fn_SuchAndSuch
End Sub
*PLEASE NOTE: the process is not the successfull starting of the DOS shell, nor even the dos exe running, it is the completion of the DOS program.
At the moment we have a dummy marker file that is created at the end of the batch file, and this file is searched for in a loop until It finds the file, which breaks the loop and continues the function, So, we don't want this solution :)
The Dos program takes about a minute or so to process, at the end of this DOS process, we want the VB function to continue on to the next line.
We have other processes running at the same time both on the computer and in the VB application, and need them to keep running while this process is doing its work.
we cannot edit the DOS program, but have a batch file which runs it.
So we need the code that goes here
private sub fn_shell()
n = Shell(MyBatchFileName)
....
....
'process to be done AFTER the Dos Process is Done
call fn_SuchAndSuch
End Sub
*PLEASE NOTE: the process is not the successfull starting of the DOS shell, nor even the dos exe running, it is the completion of the DOS program.
At the moment we have a dummy marker file that is created at the end of the batch file, and this file is searched for in a loop until It finds the file, which breaks the loop and continues the function, So, we don't want this solution :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think this might be for you:
' Shell32.Bas, Copyright ©1996 Karl E. Peterson
' Free use permitted, with attribution for source.
************************** ********** ********** ********** ********
' Three methods to "Shell and Wait" under Win32.
' One deals with the infamous "Finished" behavior of Win95.
1.
Public Function ShellAndClose(ByVal JobToDo As String, Optional ExecMode) As Long
'
' Shells a new process and waits for it to complete.
' Calling application is responsive while new process
' executes. It will react to new events, though execution
' of the current thread will not continue.
'
' Will close a DOS box when Win95 doesn't. More overhead
' than ShellAndLoop but useful when needed.
2.
Public Function ShellAndLoop(ByVal JobToDo As String, Optional ExecMode) As Long
'
' Shells a new process and waits for it to complete.
' Calling application is responsive while new process
' executes. It will react to new events, though execution
' of the current thread will not continue.
'
3.
Public Function ShellAndWait(ByVal JobToDo As String, Optional ExecMode, Optional TimeOut) As Long
'
' Shells a new process and waits for it to complete.
' Calling application is totally non-responsive while
' new process executes.
'
Link:
http://www.mvps.org/vb/code/shell32.zip
' Shell32.Bas, Copyright ©1996 Karl E. Peterson
' Free use permitted, with attribution for source.
**************************
' Three methods to "Shell and Wait" under Win32.
' One deals with the infamous "Finished" behavior of Win95.
1.
Public Function ShellAndClose(ByVal JobToDo As String, Optional ExecMode) As Long
'
' Shells a new process and waits for it to complete.
' Calling application is responsive while new process
' executes. It will react to new events, though execution
' of the current thread will not continue.
'
' Will close a DOS box when Win95 doesn't. More overhead
' than ShellAndLoop but useful when needed.
2.
Public Function ShellAndLoop(ByVal JobToDo As String, Optional ExecMode) As Long
'
' Shells a new process and waits for it to complete.
' Calling application is responsive while new process
' executes. It will react to new events, though execution
' of the current thread will not continue.
'
3.
Public Function ShellAndWait(ByVal JobToDo As String, Optional ExecMode, Optional TimeOut) As Long
'
' Shells a new process and waits for it to complete.
' Calling application is totally non-responsive while
' new process executes.
'
Link:
http://www.mvps.org/vb/code/shell32.zip
One operational note on ExecCmd. You need to adjust the properties page of the program you're shelling to so that it has "Run Minimized" and "Close on Exit" to make it a "silent runner".
M
M
ASKER
have not forgotten, my colleage has not tested this solution yet, so as soon as he does, i'll get back to you guys ;o)
ASKER
my colleage has gone on holidays...so instead mof allowing this to be auto graded, i will award the points..
Thanx all
Thanx all
ASKER