日期:2014-05-18 浏览次数:20780 次
public static bool IsRunning() { Process current = Process.GetCurrentProcess(); Process[] processes = Process.GetProcessesByName(current.ProcessName); //查找相同名称的进程 foreach (Process process in processes) { //忽略当前进程 if (process.Id != current.Id) { //确认相同进程的程序运行位置是否一样. if (Assembly.GetExecutingAssembly().Location.Replace("/", "\\") == current.MainModule.FileName) { return true; } } } return false; }