如何仅运行一个进程和一些名称的程序?
我创建了一些项目,但是当启动应用程序时。如何仅运行此应用程序一个进程并仅命名多个“test.exe”名称?什么时候午餐APP? C#2.0
i create some project but when start App. How to Run this App one Process only and name much "test.exe" name only? when Lunch APP ? C# 2.0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个看起来很有前途的示例项目:
http://www.codeproject.com/KB/cs/SingleInstanceAppMutex.aspx
我在这里引用目标:
Here's a sample project which looks promising:
http://www.codeproject.com/KB/cs/SingleInstanceAppMutex.aspx
I quote the goals here:
同样,不完全确定您要做什么,但我的解释是:
如果您想确保一次只有一个进程实例运行,请在 main 方法的开头插入以下代码(在 Program 中) 。CS)。
您需要在文件顶部包含
using System.Diagnostics
。请注意,这不是一个完美的解决方案,因为如果用户完全相同地启动该进程的两个实例,那么它们都可能会关闭。
Again, not entirely sure what it is you are going for, but my interpretation:
If you want to ensure that only a single instance of your process is ever running at once, insert the following code at the beginning of your main method (in Program.cs).
You will need to include
using System.Diagnostics
at the top of your file.Note that this is not a perfect solution, in that if a user starts two instances of the process at exactly the same time, then they will both probably close.