string moduleName = Process.GetCurrentProcess().MainModule.ModuleName;
string processName = System.IO.Path.GetFileNameWithoutExtension(moduleName); Process[] processes = Process.GetProcessesByName(processName); if (processes.Length > 1) { MessageBox.Show("程序已经运行!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); }这段代码确实有种变相的单例模式的味道,不过好象一段代码,缺少了点AI的味道,应该把当前的那个实例调用出来就会更好了...