I need to kill an application roughly so I can get phantom subscriber of that application in my database (this can not be produced by closing the application). Manually, if
Doing this through VB6 Internal ways ...
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Public Sub KillProcess(ByVal processName As String)
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
oService.Terminate
End If
Next
End Sub
...and just use it as follow:
killProcess("notepad.exe")
Second option: [ by SHELL external ways... ]
Shell "taskkill.exe /f /t /im notepad.exe"