Monitoring a DOS Shell

garyca

New member
Local time
Tomorrow, 08:45
Joined
Nov 12, 2003
Messages
6
Monitoring a DOS Shell - Resolved

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.

Code:
        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.
 
Last edited:
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.

Code:
        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.
 

Users who are viewing this thread

Back
Top Bottom