I had a similar problem, however I was working with VB 1.00 at the time.
The Shell function is supposed to return the Task ID of the Task that is
starts. I used the IsTask() Win16 API function in a loop to check if the
Task ID became invalid, when it became invalid the Task was closed. I just
used a simple while loop and used the return value of IsTask() as the
condition. I also had to use the yield API call to give up time slices in
my polling loop.
I think the IsTask() API function has been removed from the Win32 API.
It looks like you could use the following API if you are coding for the
Win32 API. You call this function supplying the Process ID, and it will
return either the exit value of the process, or an indicator that it is
still running through lpdwExitCode.
BOOL GetExitCodeProcess(hProcess, lpdwExitCode)
HANDLE hProcess;
LPDWORD lpdwExitCode;
For further information look at PSS ID Number: Q108228 from Microsoft. If
you do a search of the Knowledge Base it might turn up.
----
Applications Development
======================
Mitchell Scientific, Inc.
PO Box 2605
Westfield, NJ 07091
Tel: (908) 654-9779
Fax: (908) 232-2216
http://www.mitchellscientific.com
Quote:
> I have on old dos program writen In QuickBasic 4.5
> it does the following
> 1 Shell "AProg"
> 2 {Check files writen by AProg.exe}
> when I convert to Visual Basic, The shell app runs but the original
> program does not stop and thus, the files that need to be checked
> are from the last time AProg ran.
> what I need is
> 1 Shell "AProg"
> 2 {What untill AProg is no longer running}
> 2 {Check files writen by AProg.exe}
> But I can't seem to come up with a fool proof method.
> Is there a way in VB4 to "ask" windows what programs
> are running?
> Thanks in advance, Scott.