Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Delete a running process
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01344979
Message ID:
01345012
Vues:
15
Hi,

You can use the PID of your program to avoid killing it, modifying the code you posted in your other post
declare integer GetCurrentProcessId in WIN32API
lnMyProcess = GetCurrentProcessId()
loCIMV2	= GetObject('winmgmts://' + tcComputer + '/root/cimv2')
IF TYPE('loCIMV2') = 'O'
	*!* Check for scanners servers that weren't closed last time program was closed
	loProcesses	= loCIMV2.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'frtasktimetrack'")
	IF loProcesses.Count > 0
		For Each objProcess in loProcesses
			if objProcess.ProcessId  # lnMyProcess
				objProcess.Terminate(0)
			endif
		NEXT
	ENDIF
ENDIF	
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform