Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Kill a process
Message
 
À
08/12/2007 22:27:13
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Divers
Thread ID:
00890217
Message ID:
01274474
Vues:
18
Jay,

Did you read Message #890501? That one shows how to do it with the name of the exe instead. I would change it for something like this thou:
lparameters tcProcessID
local loLocator, loWMI, loProcesses, loProcess

if Vartype(tcProcessID) = 'C' and not Empty(tcProcessID)
	loLocator		= Createobject('WBEMScripting.SWBEMLocator')
	loWMI			= loLocator.ConnectServer()
	loProcesses		= loWMI.ExecQuery("SELECT * FROM Win32_Process WHERE Name = '" + alltrim(tcProcessID) + "'")
	For Each loProcess in loProcesses
		loProcess.Terminate(0)
	Next
endif
return
That is, using SWBEMLocator instead of monikers
"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
Répondre
Fil
Voir

Click here to load this message in the networking platform