visual studio - Why waitforexit dont work for all exe with C#? -


why of applications work waitforexit doesn't work notepad works fine bit dcomcnfg.exe doesn't reason

has edited app.manifest run application admin right

application debuged cpu

my code is:

using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using system.diagnostics;  namespace prchk {     public partial class form1 : form     {         public form1()         {             initializecomponent();         }          private void button1_click(object sender, eventargs e)         {             method();         }         public void method()         {             process prcs = new process();             prcs.startinfo.filename = @"c:\windows\system32\dcomcnfg.exe";             //p.startinfo.arguments = argu;             prcs.startinfo.useshellexecute = true;             prcs.start();             prcs.waitforexit();             messagebox.show("exited");         }     } } 

here exited showing before application exited tried:

1> has tried hasexited

2> has tried useshellexecution = false

is there way wait application exit kind of applications?


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -