GetExitCodeProcess (kernel32)
Last changed: -204.89.159.138

.
Summary

C# Signature:

[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool GetExitCodeProcess(IntPtr hProcess, out uint lpExitCode);

VB Signature:

<DllImport("kernel32.dll", SetLastError:=True)> _
Public Shared Function GetExitCodeProcess(ByVal hProcess As IntPtr, ByRef lpExitCode As System.UInt32) As Boolean
End Function

User-Defined Types:

PROCESS_INFORMATION

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

            uint exitCode;
            if (!PlatformInvoke.GetExitCodeProcess(pi.hProcess, out exitCode)) {
            int lastError = Marshal.GetLastWin32Error();
            throw new System.Runtime.InteropServices.ExternalException(" GetExitCodeProcess Error " + lastError, lastError);
            }

Alternative Managed API:

Process.HasExited

Documentation