更新时间:2022-11-06 18:51:43
private void Test_Launcb()
>
{
Process [] localByName = Process.GetProcessesByName(" ProgramName"); //
其中ProgramName是你的应用程序的名称
if(localByName.Length 1)//这个副本是1
>
{
Application.Exit();
}
}
希望这会有所帮助
Dan
" Alex K." < Al *** @ discussion.microsoft.com写信息
news:14 ************************* ********* @ microsof t.com ...
private void Test_Launcb()
{
Process [] localByName = Process.GetProcessesByName("ProgramName"); //
Where ProgramName is the name of your Application
if (localByName.Length 1) // This copy makes 1
{
Application.Exit();
}
}
Hope this helps
Dan
"Alex K." <Al***@discussions.microsoft.comwrote in message
news:14**********************************@microsof t.com...
大家好
我''我想避免在相同的
计算机上两次启动相同的c#应用程序。
如何检查它是否已经运行?
谢谢
Hi all
I''d like to avoid starting the same c# application twice on the same
computer.
How do I check if it is already running?
Thank you
Alex,
这是对不同帖子的回复它回答了你的问题:
http://groups.google.com/group/micro...128f9ddd957ada
希望这会有所帮助。
-
- Nicholas Paldino [.NET / C#MVP]
- mv * @ spam.guard.caspershouse.com
" Alex K." < Al *** @ discussion.microsoft.com写信息
news:14 ************************* ********* @ microsof t.com ...
Alex,
Here is a response to a different post which answers your question:
http://groups.google.com/group/micro...128f9ddd957ada
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Alex K." <Al***@discussions.microsoft.comwrote in message
news:14**********************************@microsof t.com...
大家好
我''我想避免在相同的
计算机上两次启动相同的c#应用程序。
如何检查它是否已经运行?
谢谢
Hi all
I''d like to avoid starting the same c# application twice on the same
computer.
How do I check if it is already running?
Thank you
Hello Dan,
考虑到这个没有在终端服务部门工作。在这种情况下
u需要使用Global Mutex
DTprivate void Test_Launcb()
DT>
DT {
DT>
DTProcess [] localByName = Process.GetProcessesByName(" ProgramName");
DT //其中ProgramName是申请名称
DT>
DTif(localByName.Length 1)//此副本生成1
DT>
DT {
DT>
DTApplication.Exit();
DT>
DT}
DT>
DT}
DT>
DTHope这有帮助
DTDan
DT" Alex K." < Al *** @ discussion.microsoft.com写信息
DTnews:14 ************************* ********* @ micros oft.com ...
DT>
Hello Dan,
Take into account that this doesn''t work in Terminal Services. In that case
u need to use Global Mutex
DTprivate void Test_Launcb()
DT>
DT{
DT>
DTProcess [] localByName = Process.GetProcessesByName("ProgramName");
DT// Where ProgramName is the name of your Application
DT>
DTif (localByName.Length 1) // This copy makes 1
DT>
DT{
DT>
DTApplication.Exit();
DT>
DT}
DT>
DT}
DT>
DTHope this helps
DTDan
DT"Alex K." <Al***@discussions.microsoft.comwrote in message
DTnews:14**********************************@micros oft.com...
DT>
>大家好
我想避免两次启动相同的c#应用程序相同的
电脑。
如何检查它是否已经在运行?
谢谢
>Hi all
I''d like to avoid starting the same c# application twice on the same
computer.
How do I check if it is already running?
Thank you
- -
WBR,
Michael Nemtsev ::博客: http://spaces.live.com/laflour
有时一个人仍然忠于某一事业只是因为其对手没有
不再是平淡的。 (c)Friedrich Nietzsche
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche