Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ShellExecute WaitForSingleObject IsRunning(GeorgeTasker)
Message
De
22/03/2004 08:21:45
 
 
À
19/03/2004 16:14:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00887963
Message ID:
00888484
Vues:
57
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform