private bool ProgramIsRunning(string FullPath) { string FilePath = Path.GetDirectoryName(FullPath); string FileName = Path.GetFileNameWithoutExtension(FullPath).ToLower(); bool isRunning = false; Process[] pList = Process.GetProcessesByName(FileName); foreach (Process p in pList) if(p.MainModule.FileName.StartsWith(FilePath, StringComparison.InvariantCultureIgnoreCase)) isRunning = true; return isRunning; } ProgramIsRunning(@"c:\loc1\test.exe");
TCP
B
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)