Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement