Re: Not getting process state
- From: Ashutosh Bhawasinka <smbs-msdn@xxxxxxxxxxxxx>
- Date: Thu, 15 May 2008 01:33:29 +0530
Hi,
Thanks for pointing out the mistake....it's such a silly one :)
Actually, I was more interested in the callback. Do, you have any clue on that??
Regards,
Ashutosh
Gilles Kohl [MVP] wrote:.
On Thu, 15 May 2008 00:19:55 +0530, Ashutosh Bhawasinka.
<smbs-msdn@xxxxxxxxxxxxx> wrote:
Hi,
I am starting a process and I need to monitor it (wait and check if its still responding).
But, I it seems that the Process.HasExited or Process.Exited doesn't work.
I just need to know if the process is running & responding.
I am using
void somefn(...)
{
if(...)
{
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = this.Path;
psi.Arguments = this.CreateArguments();
psi.ErrorDialog = false;
psi.UseShellExecute = true; //tried with false also
Process p = Process.Start(psi);
p.Exited += new EventHandler(Exited);
Hmm, try swapping the two lines above ...
while (p.HasExited)
Don't you mean while(!p.HasExited)?
{
Thread.Sleep(1000);
}
}
return Success;
}
void Exited(object sender, EventArgs e)
{
MessageBox.Show("Done");
}
The execution never enters the while loop nor the Exited method is called.
Any ideas???
See above ...
Regards,
Gilles.
- Follow-Ups:
- Re: Not getting process state
- From: Linda Liu[MSFT]
- Re: Not getting process state
- From: Gilles Kohl [MVP]
- Re: Not getting process state
- From: parez
- Re: Not getting process state
- References:
- Not getting process state
- From: Ashutosh Bhawasinka
- Re: Not getting process state
- From: Gilles Kohl [MVP]
- Not getting process state
- Prev by Date: asynchronous web method calls - begin without end
- Next by Date: Re: Provide a link to a secure website from a WinForms application
- Previous by thread: Re: Not getting process state
- Next by thread: Re: Not getting process state
- Index(es):
Relevant Pages
|