Checking for Other Apps running

J

jjmraz

Hi,

I have a need to create an app that will check on my pc what apps are
running and if one is found that shouldn't be running, shut it down.
How can I do this in c# or what areas should I be looking at in the
framework? Code samples or snips appreciated.

Thanks,

JJ
 
L

Lars Behrmann

Hi,

you could use the Process class of the framework. With the GetProcesses
method you get the processes with the Kill method you can stop a
process.

Cheers
Lars Behrmann

_________________
Nothing is impossible. UML is the key for all your problems.
AODL - Make your .net apps OpenOffice ready
http://aodl.sourceforge.net/
 
M

Mihir Solanki

something like this


Process[] processes = Process.GetProcesses();
foreach(Process process in processes){
if(process.MainWindowTitle == "SomethingWhatIWant"){
process.CloseMainWindow();
// or if it is not having main window then kill it
// use only one of this, dont need both
process.Kill();
}
}



Mihir Solanki
http://www.mihirsolanki.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top