Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Kill a process
Message
De
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:
01274233
Vues:
26
Hey Hugo, I've been reading through this thread because I need a way to kill a running EXE from within another EXE. I can't quite find where the solution is, even though this message was marked as such. Is there a full code block in here somewhere that shows how you do this? Also, it assumes I know the processID, but I'm not sure how to get that. Looking that up now, but wanted to get the message posted in case you are awake and bored... <g>

>Selim, did you try my method and did not work? It should work in W2K and WXP
>
>Try replacing
>
oShell.Run("TaskKill /PID " + ALLTRIM(STR(wlprocessid.ProcessId))
>with
>
KillProcess(wlprocessid.ProcessId)
>
>Doesn't this work? What is the error? It works fine for me.
>
>
>
>procedure KillProcess(tnProcessID)
>
>loCIMV2		= GetObject("winmgmts://localhost/root/cimv2")
>loProcesses	= loCimv2.ExecQuery("SELECT * FROM Win32_Process WHERE ProcessId = " + alltrim(str(tnProcessID)))
>For Each objProcess in loProcesses
>	objProcess.Terminate(0)
>Next
>return
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform