0

okay so i have this button

private void button2_Click(object sender, EventArgs e)
        {
            OpenFileDialog fDialog = new OpenFileDialog();
            fDialog.Title = "Open Injector";
            fDialog.Filter = fDialog.Filter = "Exe Files|*.exe";
            fDialog.InitialDirectory = @"C:\";
            if (fDialog.ShowDialog() == DialogResult.OK)
            {

                MessageBox.Show(fDialog.FileName.ToString());
                fDialog.CheckFileExists = true;

                fDialog.CheckPathExists = true;

            }
            string str = fDialog.FileName;
            Process process = new Process();
            process.StartInfo.FileName = str;
            process.Start(); ;
            {
                string str1 = @"C:\Nexon\MapleStory\GameLauncher.exe";
                Process process1 = new Process();
                process1.StartInfo.FileName = str1;
                process1.Start();

            }
        }

and the problem is that only in windows 7 and vista it works with right click run as admin,and for xp its works finr like this.
how shall i check for the os and run as admin

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by minitech
0

I don't know how you might run as an administrator, but you can do a Windows 7/Vista check with this:

if(Environment.OSVersion.Platform == PlatformID.Win32NT && Environment.OSVersion.Version.Major >= 6) {
     // The OS is Win7 or Vista
} else {
     // It's something else
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.