zoukankan      html  css  js  c++  java
  • 防止应用程序重复打开

    using ReadCardService.ServiceBus;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using PurClient.Logging;

    namespace ReadCardService.WinUI
    {
    static class Program
    {
    /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main()
    {

    //System.Threading.Mutex mutex = new System.Threading.Mutex(false, "应用程序的程序集GUID号");
    System.Threading.Mutex mutex = new System.Threading.Mutex(false, "e8feb7e7-e733-46a6-8afe-365e224dd1c7");

    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    bool running = !mutex.WaitOne(0, false);
    if (!running)
    {
    Application.Run(new FormLogs());
    }
    else
    {
    MessageBox.Show("程序已经启动,请勿重复打开");
    }


    }
    }
    }

  • 相关阅读:
    typescript
    js-解决安卓手机软键盘弹出后,固定定位布局被顶上移问题
    vue
    js
    Object.assgin基本知识与相关深浅拷贝
    js-工具方法(持续更新)
    vue
    vue
    git
    css
  • 原文地址:https://www.cnblogs.com/yaoxiaodan/p/8422190.html
Copyright © 2011-2022 走看看