1 Star 1 Fork 1

liuzy88/TxJsq

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Program.cs 1.24 KB
一键复制 编辑 原始数据 按行查看 历史
liuzy88 提交于 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());
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/liuzy1988/TxJsq.git
git@gitee.com:liuzy1988/TxJsq.git
liuzy1988
TxJsq
TxJsq
master

搜索帮助

Cb406eda 1850385 E526c682 1850385