博客
关于我
C# WinForm 只允许运行一个实例
阅读量:403 次
发布时间:2019-03-05

本文共 297 字,大约阅读时间需要 1 分钟。

核心代码:

public static void OnlyRunOneCheck()        {            bool isRun;            System.Threading.Mutex mutex = new System.Threading.Mutex(true, Application.ProductName, out isRun);            if (isRun == false)            { Mbox.Info("目前已有一个程序在运行,请勿重复运行程序"); Environment.Exit(0); }        }

 

转载地址:http://brazz.baihongyu.com/

你可能感兴趣的文章
NO 157 去掉禅道访问地址中的zentao
查看>>
no available service ‘default‘ found, please make sure registry config corre seata
查看>>
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
查看>>
no connection could be made because the target machine actively refused it.问题解决
查看>>
No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
查看>>
No fallbackFactory instance of type class com.ruoyi---SpringCloud Alibaba_若依微服务框架改造---工作笔记005
查看>>
No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalanc
查看>>
No mapping found for HTTP request with URI [/...] in DispatcherServlet with name ...的解决方法
查看>>
No mapping found for HTTP request with URI [/logout.do] in DispatcherServlet with name 'springmvc'
查看>>