|
|
|
Closing another program
Started by theDentist at 04-10-2006 10:11 AM. Topic has 4 replies.
|
|
04-10-2006, 10:11 AM
|
theDentist
Joined on 12-05-2005
Posts 42
|
|
|
|
Hi all,
Can anyone tell me what function will end another process or program from within my program, the reverse of "ShellExecute" if you like, instead of starting something, stopping it.
Peter
|
|
|
|
|
Report
|
|
|
|
04-10-2006, 6:31 PM
|
Yasir
Joined on 03-15-2006
Posts 44
|
Re: Closing another program
|
|
|
|
|
Hi
As per my knowledge there is no exact match api of shellExecute which takes a file name and kill its process if its running. i remeber once i have done it by some other trick by looping in to all curren runing process get their pid's then get there File path by using Getmodulebasename etc and then finnaly getting handle of that process and call TerminateProcess on that handle and it will terminate it.
Best Regards
-Yasir
|
|
|
|
|
Report
|
|
|
|
04-14-2006, 1:03 AM
|
theDentist
Joined on 12-05-2005
Posts 42
|
Re: Closing another program
|
|
|
|
|
|
Hi,
Thanks Yasir, I can see your logic, I'll give it a try
Peter
|
|
|
|
|
Report
|
|
|
|
11-09-2006, 6:11 AM
|
Skizmo

Joined on 01-19-2006
Holland
Posts 5
|
Re: Closing another program
|
|
|
|
|
with FindWindow (....) you can find the mainwnd that belongs to the program, and then you can use SendMessage (WM_QUIT) to send a close signal (although no all programs react as the should on that message, but 'normally' it will work)
|
|
|
|
|
Report
|
|
|
|
11-16-2006, 5:06 AM
|
Yasir
Joined on 03-15-2006
Posts 44
|
Re: Closing another program
|
|
|
|
|
But i dont think it will work with the executable name. For Findwindow you should be aware of the class name for that window and Window name.
Any how if it does work plz post the piece of the code.
Regards
-Yasir
|
|
|
|
|
Report
|
|
|
|
| |
|