CoderSource.net
Search
Closing another program
Started by theDentist at 04-10-2006 10:11 AM. Topic has 4 replies.

Print Search « Previous Thread Next Thread »
   04-10-2006, 10:11 AM
theDentist is not online. Last active: 1/5/2008 4:01:46 PM theDentist

Top 10 Posts
Joined on 12-05-2005
Posts 42
Closing another program

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 is not online. Last active: 11/16/2006 10:02:40 AM Yasir

Top 10 Posts
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 is not online. Last active: 1/5/2008 4:01:46 PM theDentist

Top 10 Posts
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 is not online. Last active: 11/9/2006 11:09:26 AM Skizmo



Top 10 Posts
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 is not online. Last active: 11/16/2006 10:02:40 AM Yasir

Top 10 Posts
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 
Codersource.Net » Programming » MFC Programming » Closing another program

MENU
Home
MFC 
C++
.Net
WIN32
Programming
Forum
My Articles
Welcome to Codersource.Net Login | Register | Faq  

Google
 

NOTES:


Thanks for visiting our CoderSource.net. This site will be improved with more articles. Interested visitors can also submit their articles through the Submit Article link.Your article will also be published after due consideration by the editor. 

© Copyright 2003. All rights on content reserved by CoderSource.net. Contact    About Us