Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting notified from Shell command
Message
From
05/11/1999 16:37:58
 
 
To
05/11/1999 15:45:56
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00287768
Message ID:
00287812
Views:
17
>Hello all,
>
>
>Im executing a Shell command that unzips some files which I downloaded from ftp. While the Shell runs asynchronously I want to stop the execution of my program until the Shell finishes executing.
>Is there any API functions which returns the status of Shell command?

What do you mean by a Shell command? If you mean you're using RUN to trigger an app that runs asynchrnously, yes, you can launch the application using the CreateProcess() API, which returns a process id and process handle, and you can track the progress of the spawned executable using CheckProcessExitCode(). This is the technique I use in API_APPRUN, which has a LaunchApp and a LaunchAppAndWait method, and can poll the process exit code to see if its still running, and if not, what the termination code is.

If you use a VFP RUN command, try API_APPRUN instead.

If you're launching indirectly using something that relies on the ShellExecute() API call, you'd need to rewrite the call to use ShellExecuteEx(), which also returns a process id and handle (the process handle returned by ShellExecute() is a pretty useless pseudohandle). You could then track execution progress using the same CheckProcessExitCode() API call.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform