C#简单实现防止多个程序运行的方法
作者:Microblue 时间:2021-07-31 04:36:27
本文实例讲述了C#简单实现防止多个程序运行的方法。分享给大家供大家参考,具体如下:
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
System.Diagnostics.Process[] ps = System.Diagnostics.Process.GetProcessesByName(System.Diagnostics.Process.GetCurrentProcess().ProcessName);
if (ps.Length <= 1)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
else
{
return;
}
}
希望本文所述对大家C#程序设计有所帮助。
标签:C#,程序运行
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Android实战教程第五篇之一键锁屏应用
2023-12-03 18:47:36
![](https://img.aspxhome.com/file/2023/1/87291_0s.jpg)
Java与SpringBoot对redis的使用方式
2021-06-11 19:23:39
![](https://img.aspxhome.com/file/2023/6/78916_0s.png)
Java类之间的关系图_动力节点Java学院整理
2022-07-31 23:03:46
![](https://img.aspxhome.com/file/2023/9/68569_0s.jpg)
SpringBoot项目集成xxljob实现全纪录
2023-01-18 17:26:21
![](https://img.aspxhome.com/file/2023/4/86044_0s.png)
RestTemplate 401 获取错误信息的处理方案
2023-01-14 10:37:44
![](https://img.aspxhome.com/file/2023/7/85427_0s.png)
Java的Spring框架中AOP项目的一般配置和部署教程
2021-07-26 16:49:25
SpringBoot配置Profile实现多环境支持
2023-07-29 21:53:20
![](https://img.aspxhome.com/file/2023/9/85419_0s.png)
读取Java文件到byte数组的三种方法(总结)
2023-08-01 17:19:39
SpringBoot如何进行对象复制的实践
2023-11-23 03:40:19
![](https://img.aspxhome.com/file/2023/5/59935_0s.jpg)
Java面向对象程序设计:继承,多态用法实例分析
2021-08-03 06:54:04
![](https://img.aspxhome.com/file/2023/4/79864_0s.png)
Java微信公众平台开发(14) 微信web开发者工具使用
2023-01-30 19:21:34
![](https://img.aspxhome.com/file/2023/0/67150_0s.jpg)
Java实现五子棋(附详细源码)
2023-10-19 15:20:54
![](https://img.aspxhome.com/file/2023/4/63384_0s.jpg)
java导出Excel通用方法实例
2023-10-27 04:43:33
![](https://img.aspxhome.com/file/2023/0/62120_0s.png)
Java面试题冲刺第十六天--消息队列
2022-08-08 09:07:04
![](https://img.aspxhome.com/file/2023/0/69090_0s.png)
SpringBoot中自定义注解实现参数非空校验的示例
2022-04-12 10:55:55
![](https://img.aspxhome.com/file/2023/0/70260_0s.webp)
IntelliJ IDEA使用教程从入门到上瘾(2019图文版)
2023-03-30 17:00:49
![](https://img.aspxhome.com/file/2023/8/92678_0s.png)
c#与WMI使用技巧集第1/2页
2022-03-16 05:16:01
Struts2学习教程之拦截器机制与自定义拦截器
2021-10-27 13:02:56
SpringMVC请求参数的使用总结
2022-11-30 22:23:18
![](https://img.aspxhome.com/file/2023/0/79320_0s.png)
SpringBoot + validation 接口参数校验的思路详解
2023-10-09 11:59:12