如标题!

解决方案 »

  1.   

    通过 System.Diagnostics.Process[] ExcelProcesses;
    ExcelProcesses = System.Diagnostics.Process.GetProcessesByName("进程");
    判断实现
      

  2.   

    我的困惑就是像Kenthong所说的,不知道Kenthong有没有什么办法解决啊?
      

  3.   

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;namespace test_MyApplication
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        void button1_Click(object sender, EventArgs e)
            {
                this.Close();
                System.Diagnostics.Process.Start("test_MyApplication.exe");
            }
        }
    }
      

  4.   

    string cx=Application.ExecutablePath.Trim();
    process1.StartInfo.FileName=cx;
    process1.StartInfo.WorkingDirectory=System.IO.Directory.GetCurrentDirectory();
    Application.ExitThread();
    process1.Start();
      

  5.   

                Application.Restart();
      

  6.   

    程序只运行一个,可以用API  CreateMutex
      

  7.   

    只运行一个程序
    [STAThread]
    public static void Main()
    {
        bool ret;
        System.Threading.Mutex mutex = new System.Threading.Mutex(true, Application.ProductName, out ret);
        if (ret)
        {
            System.Windows.Forms.Application.EnableVisualStyles();   //这两行实现   XP   可视风格   
            System.Windows.Forms.Application.DoEvents();
            System.Windows.Forms.Application.Run(new Main());
            //   Main   为你程序的主窗体,如果是控制台程序不用这句   
            mutex.ReleaseMutex();
        }
        else
        {
            MessageBox.Show(null, "有一个和本程序相同的应用程序已经在运行,请不要同时运行多个本程序。\n\n这个程序即将退出。", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //   提示信息,可以删除。   
            Application.Exit();//退出程序   
        }
    }