I have to run a VB application, which should determine if there are two other apps are running and if they are kill them. I know the exe names of the applications that needs to be shut down.
Thanks in advance
Printable View
I have to run a VB application, which should determine if there are two other apps are running and if they are kill them. I know the exe names of the applications that needs to be shut down.
Thanks in advance
Knowing the exe's name doesn't help ypu, what you need is the name of the window or the process, that these two other programs start.
I do have the window name and the process names is same as exe name. How do I get handle to the app and once I have the handle how do I kill the app
Thanks
It depens rather alot on what kind of program it is. Terminating a program through it's process is never a very good idea, since it doesn't let the program terminate properly.
Normally you would find the windowhandle, by using the FindWindow API call, using the newlyu found handle, send a the WM_CLOSE message (using the SendMessage API) to the window, this should terminate the window, and hopefully also the program.
If the program doesn't terminate, then you propoerly have to terminate the process itselft, using the TerminateProcess API call. (This should be your last resort)
Thanks.. I appreciate the help. I will try these options. Hopefully they work
All VB forms have classname of ThunderForm, so all you have to do is to enumerate through all windows that have a classname of ThunderForm.