End Process from Task Manager using VB 6 Code

后端 未结 8 1250
被撕碎了的回忆
被撕碎了的回忆 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:40
    Shell "taskkill.exe /f /t /im processname.exe"
    

    This forces (/f) the terminatation of the process with the image name (/im) of processname.exe, and any child processes which were started by it (/t). You may not need all these switches. See the taskkill command help for more information (type the following at the command line):

    taskkill/?
    
    0 讨论(0)
  • 2021-01-13 03:41

    Karl Peterson's excellent archive of VB6 code has high quality sample code and full explanations using both WM_CLOSE and TerminateProcess. Accept no substitutes!

    One pitfall you might see in a lot of code out there is that sending WM_CLOSE to a single window handle you have isn't sufficient - most applications comprise numerous windows. The answer as implemented in Karl's code: Find all the top-level windows belonging to this application and send the message to each.

    0 讨论(0)
提交回复
热议问题