[C#] Process Wait for Exit? [/C#]
Hey, is there a wait statement for processes like the one in this code snippet:
Code:
private void StopService(string serviceName, int timeoutMilliseconds)
{
using (ServiceController service = new ServiceController(serviceName))
{
//service.DisplayName = ;
// Do not Stop the service if it is already stopped
if (service.Status == ServiceControllerStatus.Stopped)
return;
try
{
TimeSpan timeout = TimeSpan.FromMilliseconds(timeoutMilliseconds);
service.Stop();
service.WaitForStatus(ServiceControllerStatus.Stopped, timeout);
}
catch (Exception)
{
}
}
}
Right at this point:
Code:
service.WaitForStatus(ServiceControllerStatus.Stopped, timeout);
Is there something like that for a process?
Thanks, in advance.
Re: [C#] Process Controller? [/C#]
Re: [C#] Process Controller? [/C#]
Quote:
Originally Posted by
TomTheBeast
Bump
Please do not bump threads when it has been less than 24 hours between your last post in that thread and if no one else has posted.
Re: [C#] Process Controller? [/C#]
As suggested, please don't bump your threads at all, never mind after less than an hour an a half. We're all volunteers here and we'll get to your question if and when we can. As long as your thread is on the first page, which it will likely be for days in the C# forum, then it is visible and there's no call for you to bump it. If it does slip off the first page, or you just feel that it hasn't been answered in a timely fashion, then you should ask yourself why and try rephrasing the question or providing some more relevant information.
As for the question, there is a Process class that allows you to perform some management of processes.
Re: [C#] Process Controller? [/C#]
Alright, im sorry, but thats sorta what my question is, since there is a process management class, how would i use it?
Re: [C#] Process Controller? [/C#]
Quote:
Originally Posted by
TomTheBeast
Alright, im sorry, but thats sorta what my question is, since there is a process management class, how would i use it?
You would start by reading the documentation and finding out what members it has and what each can do. If you're not sure exactly how to proceed then, at least you'll have a better idea of what specific questions to ask.
That said, if I remember correctly, I posted to the VB.NET CodeBank forum some code for ending processes. You can follow the CodeBank link in my signature to check that out.
Re: [C#] Process Wait for Exit? [/C#]
Changed the question, i figured my old one out, and instead of making a new post, i just changed this one.
Re: [C#] Process Wait for Exit? [/C#]
Bump, i don't see it on the first page.