using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Diagnostics;

 

namespace WindowsFormsApplication1
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
        static bool TestIfAlreadyRunning()
        {
            Process processCurrent = Process.GetCurrentProcess();
            Process[] processes = Process.GetProcesses();
            foreach (Process process in processes)
                if (processCurrent.Id != process.Id)
                    if (processCurrent.ProcessName == process.ProcessName)
                        return true;
            return false;
        }
    }
}

posted on 2010-09-03 20:11  TsingCai  阅读(200)  评论(0编辑  收藏  举报