This task is easy if your application Spawned/Shelled the other application with the CreateProcess API function.
If your application did NOT launch the other executable, then You need to get a Handle to the other program's main window. (This is where the WindProc resides).
Once you have this handle, you can basically make the other application do anything you want (by sending windows messages).
A few API calls to look into when doing this:
EnumWindows
GetWindowText
PostQuitMessage
If this doesn't help, there's probably another way ... there always is.
You'll need to hook the other application and from there you can terminate it. The code is too long to display here. If you search for how-tos on hooking other applications, you'll probably find out how. I know I saw an example on
under the C/C++ section, try searching their website for "Hook" and "Title Bar" that code should point you in the right direction.
Also, I recall an article in "C++Builder Developer's Journal" just a little while back. I know they posted a zip of the code on it. Try downloading their zips for 2002. I pretty sure they have an example of what you want in there somewhere. Once I get some time, I'll try and find it for you. Cyprus
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.