I try to pragrammatically run applications such as notepad.exe and Calc.exe with the following codes. I can see the application is activated in Process Exprorer but the application UI does not appear on the screen. I got this info inside the process p - "Process must exit before requested information can be determined" and the exitcode are 1200, 5084, etc. What is wrong? Thanks!
Codes -
ProcessStartInfo pInfo = new ProcessStartInfo(@"C:\Windows\system32\notepad.exe");
pInfo.UseShellExecute = false;
pInfo.CreateNoWindow = false;
pInfo.WindowStyle = ProcessWindowStyle.Normal;
Process p = Process.Start(pInfo);
p.EnableRaisingEvents = true;
int exitCode = p.Id;
p.WaitForExit();
p.Close();