Answers for "c# close application if other application opened"

C#
0

how to close another app in system with c#

Process[] runningProcesses = Process.GetProcesses();
foreach (Process process in runningProcesses)
{
    // now check the modules of the process
    foreach (ProcessModule module in process.Modules)
    {
        if (module.FileName.Equals("MyProcess.exe"))
        {
            process.Kill();
        } else 
        {
         enter code here if process not found
        }
    }
}
Posted by: Guest on November-12-2020

Code answers related to "c# close application if other application opened"

C# Answers by Framework

Browse Popular Code Answers by Language