Can not start an desktop application in C#'s Process

Posted by Don on Stack Overflow See other posts from Stack Overflow or by Don
Published on 2010-05-18T16:25:51Z Indexed on 2010/05/18 16:30 UTC
Read the original article Hit count: 271

Filed under:
|

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();

© Stack Overflow or respective owner

Related posts about c#

Related posts about process