1

Possible Duplicate:
How to wait for a shell process to finish before executing further code in VB6

I'd like to write program that will generate text file, process it with another one and then load results.

As I'm experimenting the code is slightly different:

Main.Command2.Enabled = False
Shell "foobar.exe =bar.txt +" & "foo.txt", vbMinimizedNoFocus
Main.Command2.Enabled = True
Kill "bar.txt"

and the bar.txt file still remains in the directory and foobar's testing routine doesn't throw error that bar.txt exists.

How can I force my program to wait until foobar.exe finishes?

Resolved at How to wait for a shell process to finish before executing further code in vb6

Community
  • 1
  • 1
Crowley
  • 2,279
  • 6
  • 22
  • 36
  • This isn't really a "call" as such, just running a child process. Do you really want to do a synchronous wait here though? Almost defeats the purpose of using a child process. You could use a Timer to poll the child for completion though, it is very similar to a sync wait with only slight changes. – Bob77 Jun 07 '11 at 07:48
  • @Bob: Problem is that this program is written in c++ and is closed. `foo` file is only set of input parameters and `bar` is same as screen output. And timer is also useless because I do not know how long the `foobar` will work. – Crowley Jun 07 '11 at 08:03

0 Answers0