Re: Not getting process state

Tech-Archive recommends: Fix windows errors by optimizing your registry



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.

.



Relevant Pages

  • Re: Obscurity...
    ... It is considered polite to quote the text to which you are responding. ... You are as welcome to yourown opinion, as I am to disagree with it, and ... implies that you may have actually had a clue about the point I was making. ... and not those of Bar-Ilan University ...
    (rec.music.compose)
  • Re: Jump instruction
    ... selection of technical terms on a page with no clue as to their meaning, ... short jmp can't be equal to far jmp. ... 'top dog' is responding this thread so just take it easy and take ...
    (comp.arch.embedded)
  • Re: Mathematics of cornering
    ... And you've hoodwinked everyone else on here by replying to something ... A little of the post you're responding to gives us a ... clue. ... WD-40 can be used to counter-steer. ...
    (rec.motorcycles)
  • Re: Mathematics of cornering
    ... And you've hoodwinked everyone else on here by replying to something ... A little of the post you're responding to gives us a ... clue. ... Just like that old bastard Galalao ...
    (rec.motorcycles)
  • Re: Mathematics of cornering
    ... And you've hoodwinked everyone else on here by replying to something ... A little of the post you're responding to gives us a ... clue. ... 2006 Honda 599 Hornet ...
    (rec.motorcycles)