0

I want to run an application from my code, that application can only be run with administrative rights. I am able to run the application successfully with the following code.

start = new ProcessStartInfo();
start.Arguments = drive;
start.Verb = "runas";
start.FileName = filepath;
start.WindowStyle = ProcessWindowStyle.Normal;
start.CreateNoWindow = false;
using (exeProcess = Process.Start(start))
{
    exeProcess.WaitForExit();
}

Following MessageBox appears;

Screenshot of MessageBox

What I want to do is I want to suppress above mentioned Windows Messagebox, and show my own designed Messagebox. Kindly guide me how can I do it.

  • The only way I know you can do this is to start your program with administration rights. Then all programs it starts will be with administration rights without asking for permission. But I guess that's not what you are looking for. – R.Rusev Aug 16 '16 at 09:48
  • @R.Rusev Not a solution which I am looking for – user3069453 Aug 16 '16 at 09:52
  • Some useful information about UAC and processes: http://stackoverflow.com/a/20872219/856777 – Lucian Aug 16 '16 at 09:58

1 Answers1

1

Essentially what you want to do is Disabling UAC programmatically which is not possible according to the link.

Community
  • 1
  • 1
R.Rusev
  • 1,111
  • 15
  • 19
  • No I just want to display my own message in messagebox – user3069453 Aug 16 '16 at 11:14
  • 1
    @user3069453 well you can't. It's a security issue. If you can change the dialog you can change the text/buttons so they say something differnt which is almost the same as removing the window all together. – R.Rusev Aug 16 '16 at 11:25