Asynchronous problem

D

David I

I am trying to shell a program as so

nResult = shell(" mcrypt.exe", 0)

This works fin but then I want to kill its temp file once it is finished. As
we all know Shell is asynchronous so I have this untill the user closes the
program.

while(tasks.exists(""mcrypt.tmp"))
' Delay
wend

Then the kill

Kill("mcrypt.tmp")

Single stepping through this it appears to work perfectly but in realtime
the kill gives me a 'Path/File access error' intermittently which means my
delay is not working properly. It appears to get to the kill after the
program has been removed from the task list but before it has actually
ended. Is there a better way around this?

And does anybody know what exactly is the task ID returned by the shell
command. It does not appear to have anything to do with the tasks.item
method

Many thanks
 
D

David I

Oops mucked up

Try

while(tasks.exists("mcrypt"))
' Delay
wend

That should make more sense
 
J

Jonathan West

David I said:
I am trying to shell a program as so

nResult = shell(" mcrypt.exe", 0)

This works fin but then I want to kill its temp file once it is finished.
As
we all know Shell is asynchronous so I have this untill the user closes
the
program.

while(tasks.exists(""mcrypt.tmp"))
' Delay
wend

Then the kill

Kill("mcrypt.tmp")

Use the ShellAndWait command from here

http://vb.mvps.org/samples/project.asp?id=Shell32
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top