Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CreateProcess Problems
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00852013
Message ID:
00852307
Views:
16
Thanks Anatoliy,

I'll try it!

>Hi Tracy,
>
>May be try
>lcdir = SYS(5)+SYS(2003)
>
>Also this code works slightly better (modified recently):
>PROCEDURE RunAndWait (lcApp, lcCmdLine)
>#DEFINE START_INFO_SIZE 68
>#DEFINE INFINITE  0xFFFFFFFF
>
>	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
>
>	LOCAL cStartupInfo, cProcInfo, hProcess, hThread
>	cStartupInfo = PADR(Chr(START_INFO_SIZE), START_INFO_SIZE, Chr(0))
>	cProcInfo = Repli(Chr(0), 16)
>
>	IF CreateProcess(lcApp, lcCmdLine, 0,0,0,0,0,;
>		SYS(5)+SYS(2003), @cStartupInfo, @cProcInfo) <> 0
>
>		* process and thread handles returned in ProcInfo structure
>		hProcess = buf2dword(SUBSTR(cProcInfo, 1,4))
>		hThread = buf2dword(SUBSTR(cProcInfo, 5,4))
>
>		* waiting until the termination
>		= WaitForSingleObject(hProcess, INFINITE)
>
>		= CloseHandle(hThread)
>		= CloseHandle(hProcess)
>	ELSE
>		? "Error code:", GetLastError()
>	ENDIF
>
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Reply
Map
View

Click here to load this message in the networking platform