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("程序已经启动,请勿重复打开");
    }


    }
    }
    }

  • 相关阅读:
    LeetCode
    LeetCode
    LeetCode
    位运算实现加法运算
    反转字符串
    数组中的逆序对
    矩阵中的路径
    机器人的运动范围
    滑动窗口的最大值
    HTML5全屏浏览器兼容方案
  • 原文地址:https://www.cnblogs.com/yaoxiaodan/p/8422190.html
Copyright © 2011-2022 走看看