|
-
Mar 19th, 2011, 11:53 AM
#1
Thread Starter
New Member
[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.
Last edited by TomTheBeast; Mar 20th, 2011 at 09:36 PM.
Reason: Changed my question.
-
Mar 19th, 2011, 01:20 PM
#2
Thread Starter
New Member
Re: [C#] Process Controller? [/C#]
-
Mar 20th, 2011, 02:31 AM
#3
Re: [C#] Process Controller? [/C#]
 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.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Mar 20th, 2011, 04:30 AM
#4
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.
-
Mar 20th, 2011, 09:36 AM
#5
Thread Starter
New Member
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?
-
Mar 20th, 2011, 07:14 PM
#6
Re: [C#] Process Controller? [/C#]
 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.
-
Mar 20th, 2011, 09:37 PM
#7
Thread Starter
New Member
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.
-
Mar 21st, 2011, 11:25 AM
#8
Thread Starter
New Member
Re: [C#] Process Wait for Exit? [/C#]
Bump, i don't see it on the first page.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|