限制应用程序的多个实例 [英] Restrict multiple instances of an application

查看:249
本文介绍了限制应用程序的多个实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好了,所以我创建了我的C#应用​​程序,创建了一个安装程序,并有工作我的机器安装。

Okay, so i've created my c# application, created an installer for it and have it working installed on my machine.

的问题是,当用户打开应用程序的exe两次,会有运行的应用的两个实例。我只希望应用程序的一个实例,以在任何时间运行,我怎么去这样做?

The problem is, when the user opens the application exe twice, there will be two instances of the application running. I only ever want one instance of the application to be running at any time, how do I go about doing this?

感谢您的帮助,

推荐答案

的常用技术,这将是创建一个名为互斥,并检查它的presence在应用程序启动。

The common technique for this will be to create a named Mutex and check for its' presence on application start.

请参阅这个或的这个这个

这篇关于限制应用程序的多个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆