LagAbuse.com

Unofficial Section => Programming => Topic started by: Lagi on September 25, 2013, 19:52

Title: I need help in C# any guru here? :)
Post by: Lagi on September 25, 2013, 19:52
I have a total simple program, that has 1 button, which i want to run an exe as a process, with elevated admin rights. I spent an hour by now to google out the working soultion for that, but everywhere i see the same solutions and still dont work. Help me im getting mad :D

the code:
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Process gcxstart = new Process();
            gcxstart.StartInfo.FileName = @"d:\test\launch.exe";
            gcxstart.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            gcxstart.StartInfo.Verb = "runas";
            gcxstart.Start();
        }
    }
}

I have no idea why everybody can have it working with the .verb = "runas" method and mine still dont want to work.
OS: win7
Visual studio 2008 C# express edition

Please help me before i cut my veins  ::)
Title: Re: I need help in C# any guru here? :)
Post by: Lagi on September 25, 2013, 19:58
I forgot to tell that no errors at building and the button works, runs the launch.exe, but not in elevated admin rights, but i must run it in admin
Title: Re: I need help in C# any guru here? :)
Post by: Lagi on September 26, 2013, 13:23
Problem Solved.
Title: Re: I need help in C# any guru here? :)
Post by: BLOODYALBOZ on October 02, 2013, 01:55
I'm glad i helped u.

:P