PDA

Click to See Complete Forum and Search --> : How do you tell when a process has ended?


jryon
Mar 9th, 2001, 02:24 PM
I have a program that someone else wrote that allows the user to select a file with a windows common dialog, and then FTP that file to a specific server.

I have been asked to change it so that it deletes the FTP'd file after the transfer is complete.

The problem is this-
The way that they were doing the FTP was by having WS_FTP installed on the PC and doing something like:

strCommand = "ws_ftp.exe c:\mydir\myfile remoteaddress\remotedir\remotefile"

shell(strCommand)

Since a shell happens asynchronously, it returns to the running code before the transfer is complete, so if I delete the file then, it is not transfered, ws_ftp locks up, and all manor of unsavory things happen.

Since shell returns the process ID of the process that it starts, how can I use that to determine when the transfer finishes, so I can then delete the file?

devmax
Mar 9th, 2001, 07:36 PM
take a look at this tip :

http://www.vb-world.net/tips/tip5.html

jryon
Mar 12th, 2001, 09:26 AM
Thank you very much. That seems to do the trick.