Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ShellExecute WaitForSingleObject IsRunning(GeorgeTasker)
Message
From
22/03/2004 08:21:45
 
 
To
19/03/2004 16:14:45
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00887963
Message ID:
00888484
Views:
52
Tracy,

I think the problem is that you still have two handles open at the moment that Acrobat Reader is closed. If you close the handles immediately after creating the process, then everything closes properly when the reader is exited by the user.

As you are not using the handles it is OK to close them. Your procedure becomes:-
PROCEDURE  RunAndWait (lcApp, lcCmdLine, lcdir)
#DEFINE INFINITE  0xFFFFFFFF
LOCAL lcStartupInfo, lcProcInfo, hProcess, ;
	lnPrio, lnIBelieve1
lnIBelieve1 = 1   && Don't remember what that was
lnPrio = 32 && Priority of Process=Normal
lcStartupInfo = CHR(68) + REPLI(CHR(0), 67)
lcProcInfo = REPLI(CHR(0), 16)
IF CreateProcess(0, m.lcApp+" "+m.lcCmdLine+CHR(0), 0,0,;
		m.lnIBelieve1, m.lnPrio,;
		0, 0, @lcStartupInfo, @lcProcInfo) <> 0
	* process and thread handles returned in ProcInfo structure
	hProcess = buf2dword(SUBSTR(lcProcInfo, 1,4))
	hThread = buf2dword(SUBSTR(lcProcInfo, 5,4))
	= CloseHandle(hThread)
	= CloseHandle(hProcess)
	* waiting until the termination
	= WaitForSingleObject(hProcess, INFINITE)
ELSE
	RETURN .F.
ENDIF
RETURN
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform