zoukankan      html  css  js  c++  java
  • Visual Studio 2005(C#)中只允许一个实例运行的一种方法

    Visual Studio 2005(C#)中只允许一个实例运行的一种方法
    using System;
    using System.Collections.Generic;
    using System.Windows.Forms;

    namespace School.ReadPaperControl
    {
        static class Program
        {
            /// <summary>
            /// The main entry point for the application.
            /// </summary>
            [STAThread]
            static void Main()
            {
                // 控制仅打开单实例进程
                if (System.Diagnostics.Process.GetProcessesByName

    (System.Diagnostics.Process.GetCurrentProcess().ProcessName).Length == 0)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new frmControl());
                }
                esle
                   messagebox.show("该程序已在运行","提示");
            }
        }
    }

    记住该记住的,忘记该忘记的,改变能改变的,接受不能改变的!
  • 相关阅读:
    ajax 新闻栏目
    ajax 瀑布流实现
    html5 canvas图片渐变
    html5 canvas图片翻转
    html5 canvas图片反色
    ajax 第一个程序
    ajax 新闻栏目
    HDU 1756 Cupid's Arrow( 判断点在多边形的内外 )
    POJ 2356 Find a multiple( 鸽巢定理简单题 )
    HDU 5762 Teacher Bo ( 暴力 )
  • 原文地址:https://www.cnblogs.com/yuanermen/p/639237.html
Copyright © 2011-2022 走看看