As with most cases, you can find you answer with API calls. Try the DestroyWindow() api, and I believe there is an end process API. You may have to call a few other APIs to get the handle (hwnd) of a window like FindWindow() or WindowFromPoint(). There is no built in VB function to close another program from code, you have to make api calls.
Thank you for your tips. What about if I want to close previous instance of this program? For instance, the program is terminated by error, and when you press ctrl+alt+del, you will see the previous instance of the same program..can you use this to close it?
I think I need some clarification here. Do you want to know how to close applications that you've created or are you talking about closing any app that may be open, like msWord, Outlook, etc?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.