Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to wait for completion of shellexec ?
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00739175
Message ID:
00746472
Views:
19
The following set of API functions do the job:
DECLARE INTEGER CreateProcess IN kernel32;
STRING lpAppName, STRING lpCmdLine, INTEGER lpProcAttr,;
INTEGER lpThrAttr, INTEGER bInhHandles, INTEGER dwCrFlags,;
INTEGER @ lpEnvir, STRING lpCurDir, STRING lpStInfo,;
STRING @ lpProcInfo

DECLARE INTEGER CloseHandle IN kernel32 INTEGER hObject

DECLARE INTEGER WaitForSingleObject IN kernel32;
INTEGER hHandle, INTEGER dwMilliseconds

* * *
First the CreateFunction is used to create a process, the lpCmdLine parameter is something like
C:\program files\Microsoft Office\Office10\excel.exe

Then, after a valid process handle returned, the WaitForSingleObject is used with this handle and INFINITE parameter to catch the moment when the process is terminated.

And finally -- the CloseHandle is used to delete the process handle.

* * *
More information on API calls:
http://www.news2news.com/vfp
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform