var preInstance = Process.GetProcesses().FirstOrDefault(p =>
            {
                try
                {
                    if (p.Id != Process.GetCurrentProcess().Id
                        && p.MainModule != null
                        && p.MainModule.FileName.ToLower() == Assembly.GetExecutingAssembly().Location.ToLower())
                        return true;

                    return false;
                }
                catch
                {
                    return false;
                }
            });

            if (preInstance != null)
            {
                MessageBox.Show("程序已在运行!");
                return;
            }

 

相关文章:

  • 2022-01-12
  • 2021-10-19
  • 2022-02-16
  • 2021-10-23
  • 2021-07-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案