End Process from Task Manager using VB 6 Code

后端 未结 8 1342
被撕碎了的回忆
被撕碎了的回忆 2021-01-13 03:14

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

8条回答
  •  不知归路
    2021-01-13 03:28

    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

提交回复
热议问题