Navigation X
ALERT
Click here to register with a few steps and explore all our cool stuff we have to offer!



   654

[HELP] C# PROCESS DETECTION LOOP

by migiwem538 - 17 February, 2022 - 07:41 PM
This post is by a banned member (migiwem538) - Unhide
This post is by a banned member (ZeroTolerance) - Unhide
147
Posts
19
Threads
5 Years of service
#2
(This post was last modified: 19 February, 2022 - 05:37 PM by ZeroTolerance. Edited 3 times in total.)
Code:
internal static class Program
    {
        private static string IsRunning(string processName)
        {
            foreach (var process in Process.GetProcesses())
            {
                if (process.ProcessName.Contains(processName))
                {
                    return process.MainModule?.FileName;
                }
            }

            return "Not running";
        }


        private static void Main(string[] args)
        {
            while (true)
            {
                var proc = IsRunning("notepad");
                Console.WriteLine(proc);
                Thread.Sleep(1000);
            }
        }
    }

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
or
Sign in
Already have an account? Sign in here.


Forum Jump:


Users browsing this thread: 1 Guest(s)