Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

End Process from Task Manager using VB 6 Code

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 we kill the application from Task Manager, the phantom subscriber will be exist. Now I need to do it automatically in VB 6 code. Help! Thanks.

like image 935
oliverwood Avatar asked Sep 04 '09 11:09

oliverwood


2 Answers

There are two ways:

  1. Send WM_CLOSE to the target application if it has a window (hidden/visible). Task Manager's "End Task" uses this method. Most of the applications handle WM_CLOSE and terminate gracefully.

  2. Use TerminateProcess API to kill forcefully - Task Manager's "End Process" uses this method. This API forcefully kills the process.

An example can be found here:

VB Helper: HowTo: Terminate a process immediately

like image 129
swatkat Avatar answered Sep 21 '22 18:09

swatkat


Use vb6.0 TaskKill

Private Sub Command1_Click()
Shell "taskkill.exe /f /t /im Application.exe"
End Sub
like image 34
Asitha Yomal Avatar answered Sep 18 '22 18:09

Asitha Yomal