View Full Version : Monitoring a DOS Shell


garyca
11-12-2003, 03:31 PM
I'm using MS Access 97 and shelling to a DOS window.

When the window autocloses, I need to proceed with my code.

Its the age old problem of halting code execution while waiting for an external process to complete.


cmdline = "c:\myexe.exe"
Shell (cmdline)
MsgBox "Click OK when processing window disappears from the task bar.", vbOKOnly


Now, obviously, I need to replace the msgbox with some DO-UNTIL loop that can check for window's presence.

garyca
11-12-2003, 04:04 PM
Fixed it. Problem solved.

I had to add a reference to the Windows Hosting Script Object (in Access 97).

Once I did that, the WHS has a nifty object that has what I need.


cmdline = "c:\myexe.exe"
Dim objShell As New WshShell
Dim z As Long
z = objShell.Run(cmdline, 2, True)


The true parameter tells the object to wait before returning control.