Shell() running asynchronously w/ VB code 
Author Message
 Shell() running asynchronously w/ VB code

Hi,

I hope someone has some insight on this function.  

Recently, I have noticed that the shell function (used to run an
executable program) does not wait for the executable to finish before
executing the next line of code.  Since this function returns a value
that lets you know if the executable ran properly or not, i am trying to
trap this value to display an update message to the user.  The problem
is that this executable takes about 2 min. to finish running.  

How can I code it so that the VB application waits for the executable to
finish before executing the next line of code?

Here's the code i'm working with:

Dim FTPIngramVal As Double

FTPIngramVal = Shell("C:\FTP.bat")

If FTPIngramVal = 0 Then        
    MsgBox "FTP SUCCESSFUL!"
Else
    MsgBox "FTP UNSUCCESFUL"
End If



Tue, 30 Nov 1999 03:00:00 GMT  
 Shell() running asynchronously w/ VB code

Run to the site below, FAQ Library, Shell section, for 3 methods.

--=20
Randy Birch, MVP
Visual Basic


Moderator, Fidonet Visual Basic Programmer's Conference

http://home.sprynet.com/sprynet/rasanen/
VBnet, The Visual Basic Developers Resource Centre



: Hi,
:=20
: I hope someone has some insight on this function. =20
:=20
: Recently, I have noticed that the shell function (used to run an
: executable program) does not wait for the executable to finish before
: executing the next line of code.  Since this function returns a value
: that lets you know if the executable ran properly or not, i am trying =
to
: trap this value to display an update message to the user.  The problem
: is that this executable takes about 2 min. to finish running. =20
:=20
: How can I code it so that the VB application waits for the executable =
to
: finish before executing the next line of code?
:=20
:=20
: Here's the code i'm working with:
:=20
: Dim FTPIngramVal As Double
:=20
: FTPIngramVal =3D Shell("C:\FTP.bat")
:=20
: If FTPIngramVal =3D 0 Then        =20
:     MsgBox "FTP SUCCESSFUL!"
: Else
:     MsgBox "FTP UNSUCCESFUL"
: End If
:



Tue, 30 Nov 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Make SHELL run non-asynchronously?

2. Using the Shell function to run a program asynchronously

3. Advanced : Shell doesn't appear to be running asynchronously

4. How can I run fast queries asynchronously

5. Running stored procedures asynchronously

6. running sp asynchronously

7. Running the dataenvironment asynchronously?

8. Shell/Run/Chain ErrorLevel Codes

9. Changing to asynchronously code

10. call ADO asynchronously (the code is here)

11. Shell program: running IE in Shell

12. See Shell. See Shell run

 

 
Powered by phpBB® Forum Software