Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / October 2007

Tip: Looking for answers? Try searching our database.

Creating a Service that monitors the processes on the OS

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris - 17 Oct 2007 14:46 GMT
I have a multithreading application that opens an app in the background from
a service and runs it. For some reason it will not close this instance of the
app when it is done using it. This is a 3rd party app. By the end of the day
I have so many instances open it will not open another one and the app
becomes useless. I then have to manually open the task manager and close the
inactive instances of this app.

Is it possible to create a service that monitors the processes on the OS and
close the inactive instances of this app?

-Chris
Ignacio Machin ( .NET/ C# MVP ) - 17 Oct 2007 14:58 GMT
Hi,

You better contact the third party provider and tell them about the problem.
What you want to do is not the best solution, you have no idea what the app
does or what resources it use.

Anyway, what you can do is get a list of Processes using
System.Diagnostics.Process.GetProcesses and just kill them by using Kill

Signature

Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.

>I have a multithreading application that opens an app in the background
>from
[quoted text clipped - 12 lines]
>
> -Chris
Chris - 17 Oct 2007 15:06 GMT
Great, I am sort of new the .Net world. Any suggestions on how to get
started. What objects do I need to grab and how would I grab them?

Thanks Again,

-Chris

> Hi,
>
[quoted text clipped - 21 lines]
> >
> > -Chris
Ignacio Machin ( .NET/ C# MVP ) - 17 Oct 2007 15:38 GMT
Hi,

Inmy post you will find what you need, the Process class, the GetProcessed
method and the most important method of all the Kill method :)

just use them wisely ;)

Signature

Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.

> Great, I am sort of new the .Net world. Any suggestions on how to get
> started. What objects do I need to grab and how would I grab them?
[quoted text clipped - 34 lines]
>> >
>> > -Chris
Chris - 17 Oct 2007 15:48 GMT
Thank you Ignacio

-Chris

> Hi,
>
[quoted text clipped - 41 lines]
> >> >
> >> > -Chris
Willy Denoyette [MVP] - 17 Oct 2007 17:47 GMT
>I have a multithreading application that opens an app in the background
>from
[quoted text clipped - 12 lines]
>
> -Chris

I'm not clear on what you mean by "it will not close this instance of the
app when it is done using it.", who is *it*, who's supposed to *close* the
application and what exactly do you mean with *close*.
What kind of application is this that you start from a Windows service?

Willy.
Ignacio Machin ( .NET/ C# MVP ) - 17 Oct 2007 18:33 GMT
Hi,

Signature

Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.

>>I have a multithreading application that opens an app in the background
>>from
[quoted text clipped - 17 lines]
> application and what exactly do you mean with *close*.
> What kind of application is this that you start from a Windows service?

From his post I think he just want to kill some process. How he decide which
process is "idle" I have no idea
Willy Denoyette [MVP] - 17 Oct 2007 20:38 GMT
> Hi,
>
[quoted text clipped - 22 lines]
> From his post I think he just want to kill some process. How he decide
> which process is "idle" I have no idea

The problem IMO,  is that the OP starts an application that was not really
designed to be started from a Service. An application that is started from a
Service needs to be as robust as a Service itself, must not assume to run in
an interactive session and must be able to recover from failures or at least
to signal failures back to the process that started the application. Anyway,
killing a process is something you do as a last resort.

Willy.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.