Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Kill a Process outside application
Message
 
To
15/05/2002 00:19:57
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00656697
Message ID:
00656701
Views:
12
This is a utility that I use. I got it some time ago from the web connection message board, I think Rick Strahl posted it if I remember correctly. I don't know if this is exactly what you are looking for, but maybe it will point you in the right direction.

You can use WMI to do this:

FUNCTION KillProcess(lcExe,lcMachine)

lcMoniker = "winmgmts://" + IIF(!EMPTY(lcMachine),lcMachine + "/","")
oWMI = GETOBJECT(lcMoniker)
loProcesses = oWMI.InstancesOf("Win32_Process")
lcExe = LOWER(lcEXE)

FOR EACH loProcess in loProcesses
IF LOWER(loProcess.Name) = lcExe
IF loProcess.Terminate() = 0
RETURN .T.
ENDIF
ENDIF
ENDFOR

RETURN .F.
Previous
Reply
Map
View

Click here to load this message in the networking platform