wpf防止打开程序多个窗口
private System.Threading.Mutex mutex; public App() { this.Startup += new StartupEventHandler(App_Startup); } private void App_Startup(object sender, StartupEventArgs e) { bool ret; mutex = new System.Threading.Mutex(true, "name", out ret); if (!ret) { MessageBox.Show("该系统已打开,请勿重复开启!", "", MessageBoxButton.OK, MessageBoxImage.Warning); Environment.Exit(0); } }
------------------------------------
承接
**视觉检测软件开发及调试
**工业软件开发
**上位机软件开发
wechat:luoran2024
qq:565934058
email:taoyuansu@qq.com
海量教育资源及影视资源下载
微信公众号:EFun科技
------------------------------------
                    
                
                
            
        
浙公网安备 33010602011771号