using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace ScrSnap
{
class ProcessCheck
{
public bool isAlreadyRunning()
{
bool running = false;
string toMatch = Application.ProductName;
Process[] procsRunning = Process.GetProcesses();
int matchesFound = 0;
foreach (Process p in procsRunning)
{
if (toMatch == p.ProcessName.ToString())
matchesFound++;
}
if (matchesFound > 1) running = true;
return running;
}
}
}
Comments