I can successfully run a new process using ShellExecuteEx, but if I access the HasExited property, a Win32Exception is thrown. What is this exception and how do I check if the process is alive?
ShellExecuteEx(ref info);
clientProcessId = NativeMethods.GetProcessId(info.hProcess);
Process clientProcess = Process.GetProcessById((int)clientProcessId);
if (clientProcess.HasExited) //<---- throws Win32Exception, but the process is alive! I can see its window
{
//run new one
}
Thanks
See Question&Answers more detail:os