维护单实例应用程序 [英] Maintaining single instance application
本文介绍了维护单实例应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直对这个应用我的,得到了这个问题。通过与不同的参数命令行
上运行程序打开不同的.exe程序。
I have been working on this application of mine and got this problem. Running program through command line with different arguments opens different .exe process.
我的问题是如何从打开同一个文件几次阻止了,是不是可以发送新的命令行参数的应用已经打开的实例。
My question is how can i prevent from opening same file few times, and is it possible to send new command line arguments to already open instance of application.
感谢。
推荐答案
下面是一个快速的方法来做到这一点。只需要使用互斥
锁。
Here is a quick way to do it. Just use a mutex
lock.
的 http://en.csharp-online.net/CSharp_FAQ:_How_ensure_that_only_one_instance_of_an_application_will_run
的 MSDN互斥锁
这篇关于维护单实例应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文