日期:2014-05-18 浏览次数:20824 次
string name = Process.GetCurrentProcess().ProcessName; int id = Process.GetCurrentProcess().Id; foreach (Process p in Process.GetProcesses()) { if (name == p.ProcessName && id != p.Id) { MessageBox.Show("你已经打开了此系统, 请先关闭!", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }
------解决方案--------------------
同意楼上
或者参考下
http://www.cnblogs.com/cyrix/articles/1874837.html