Process ExitCode is always zero?

  • Thread starter Thread starter paul.driegen
  • Start date Start date
P

paul.driegen

I'm having a bit of difficulty with retrieving a non-zero exit code
from a managed process.

Basically, Process A launches Process B and waits for Process B to
exit. When Process B does exit, the ExitCode property is examined in
process A, and a particular action is taken.

Both are managed processes. Process A uses the Process class to create
and start Process B. It then waits using Process.WaitForExit(). When
this method returns, the exit code is examined. The problem is, the
ExitCode property is always zero.

Process B was terminated using the PInvoke function PostQuitMessage(int
nExitCode) on the process' main thread, where nExitCode is a non-zero
value. Does anyone have any idea why this nonzero value isn't being
reflected back to the host process??

Any assistance would be greating appreciated!
 
Thanks for the response, but unfortunately it makes no difference..any
other suggestions?
 
Back
Top