0

I am creating app what starting another process by processStart method and because app what I am starting require administrator privilege I set the ruans verb. Second think what i want to do is that started process will not show any form. My code is:

Process process = new Process();
process.StartInfo = new ProcessStartInfo("sdfsdf", "sdfasdgdf");
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.Verb = "runas";
process.Start();

But the problem is that process.StartInfo.CreateNoWindow creates no windows and it applies to creating UAC window, what is needed to show. How to allow showing UAC window but no other?

Misaz
  • 3,694
  • 2
  • 26
  • 42
  • 2
    http://stackoverflow.com/questions/3596259/elevating-privileges-doesnt-work-with-useshellexecute-false – volody Dec 10 '15 at 18:34

1 Answers1

1

Instead of starting the 'target' app directly like this, instead create a small 'helper' app that does nothing but start the target app with CreateNoWindow.

Then you start your 'helper' app with 'runas' and without CreateNoWindow, since your 'helper' app won't create any windows that's not a problem, and since it was run with 'runas' it'll be able to run other elevated programs without 'runas' itself - and can therefore use CreateNoWindow.

PhonicUK
  • 13,486
  • 4
  • 43
  • 62