Public Function Killprc( _
strNprc As String, _
Optional DecirSINO As Boolean = True) As Boolean
On Error Resume Next
MatarProceso = False
Set OBJwmi = GetObject("winmgmts:")
If IsNull(OBJwmi) = False Then
Set ListarProc = OBJwmi.InstancesOf("win32_process")
For Each prclose In ListarProc
If UCase(prclose.name) = UCase(strNprc) Then
If DecirSINO Then
prclose.Terminate (0)
MatarProceso = True
Else
prclose.Terminate (0)
MatarProceso = True
End If
End If
Next
End If
Set ListarProc = Nothing
Set OBJwmi = Nothing
End Function
Kill Process
Code:
0 comments:
Post a Comment