1 Star 1 Fork 1

liuzy88 / TxJsq

Create your Gitee Account
Explore and code with more than 8 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
Program.cs 1.24 KB
Copy Edit Web IDE Raw Blame History
liuzy88 authored 2019-05-28 22:02 . fix
using System;
using System.Diagnostics;
using System.Windows.Forms;
namespace TxJsq
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
try
{
System.Security.Principal.WindowsIdentity identity = System.Security.Principal.WindowsIdentity.GetCurrent();
System.Security.Principal.WindowsPrincipal principal = new System.Security.Principal.WindowsPrincipal(identity);
if (!principal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator))
{
Process p = new Process();
p.StartInfo.UseShellExecute = true;
p.StartInfo.WorkingDirectory = Environment.CurrentDirectory;
p.StartInfo.FileName = Application.ExecutablePath;
p.StartInfo.Verb = "runas";
p.Start();
return;
}
}
catch { }
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

Comment ( 0 )

Sign in to post a comment

C#
1
https://gitee.com/liuzy1988/TxJsq.git
git@gitee.com:liuzy1988/TxJsq.git
liuzy1988
TxJsq
TxJsq
master

Search