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
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/?
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.