KillProcess [Funcion Corta]
Publicado: 12 Sep 2010, 20:10
Bueno me encontre con esta funcion Corta por la web y os la dejo por aqui .. es para cerrar un processo..
Modo de uso
Salu2....
Código: Seleccionar todo
Public Sub KillProcess(ByVal processName As String)
On Error GoTo ErrHandler
Dim oWMI
Dim ret
Dim sService
Dim oWMIServices
Dim oWMIService
Dim oServices
Dim oService
Dim servicename
Set oWMI = GetObject("winmgmts:")
Set oServices = oWMI.InstancesOf("win32_process")
For Each oService In oServices
servicename = LCase(Trim(CStr(oService.Name) & ""))
If InStr(1, servicename, LCase(processName), vbTextCompare) > 0 Then
ret = oService.Terminate
End If
Next
Set oServices = Nothing
Set oWMI = Nothing
ErrHandler:
Err.Clear
End Sub
Código: Seleccionar todo
Call KillProcces("TaskMgr.exe")