A
Ashutosh Bhawasinka
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);
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???
Regards,
Ashutosh
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);
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???
Regards,
Ashutosh