zoukankan      html  css  js  c++  java
  • mutex

    是程序运行的入口点:

    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(
    false);
        Application.Run(
    new Form1());
    }


    单实例限制代码:

    [STAThread]
    static void Main()
    {
        
    bool isAppRunning = false;
        System.Threading.Mutex mutex 
    = new System.Threading.Mutex(true,  System.Diagnostics.Process.GetCurrentProcess().ProcessName,  out isAppRunning);
        
    if (!isAppRunning)
        {
            MessageBox.Show(
    "本程序已经在运行了,请不要重复运行!");
            Environment.Exit(
    1);
        }
        
    else
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(
    false);
            Application.Run(
    new Form1());
        }
    }
  • 相关阅读:
    LuoguP1126 机器人搬重物(BFS)
    POJ1950----DFS
    C
    B
    A
    C
    B
    A
    A
    B
  • 原文地址:https://www.cnblogs.com/greencolor/p/1567290.html
Copyright © 2011-2022 走看看