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:
00852277
Views:
14
This message has been marked as a message which has helped to the initial question of the thread.
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform