Tuesday, August 23, 2011

Kill any Process Function

'************************** Function to Kill Process ***************************
' Created By : Baba Fakruddin Dudekula
' Created on : 22-Aug-2011
Function KillProcess(ProcessName)
Dim blnFlag
Killprocess = ProcessName '"iexplore.exe" 'per ex : calc.exe
Set ProcessList = GetObject("winmgmts://.").InstancesOf("win32_process")
blnFlag = False
For Each Process In ProcessList
   If Process.Name = KillProcess Then
      Process.Terminate
      blnFlag = True
   End If
Next
If blnFlag = False Then
   KillProcess = False
Else
   KillProcess = True
End If
End Function
' *************************** *************************** *************************** ********
"A good threat is worth a thousand tests" - Boris Beizer

No comments:

There was an error in this gadget