Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

Forgotten How To Do This

A while ago I coded a program which would prevent execution of the output file if another proces was active on the computer - for example my file would not execute if Norton was running for example. I would add the process n360.exe to the list for example and my file would be not be executed if Norton 360 was running on the computer my file was attempting to be executed on. I coded something like this a while back but I can't remember how. Could somebody please remind me on how to do this?
The obvious way would be to check if the process is running using either:
"Process.GetProcessesByName" if you know the application name, or "Process.GetProcessesByID " if you know the ID.
After that you'll just make a condition I guess.
Here is a mockup of mine. Mine is backwards tho, showing that if a process is not open, then text displaying that the game is not open pops up, but if the process is open, then it displays a different type of text showing what to do.

(ITS A MOCKUP OF A RUST CHEAT I WAS THINKING OF WORKING ON, SO ITS REALLY SHITTY BUT PERFECT TO EXPLAIN HERE)

Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.ComponentModel;

namespace Rustcheat
{
    class Program
    {
        static void Main(string[] args)
        {
            string process = "RustClient";
            Process[] pname = Process.GetProcessesByName(process);
            if (pname.Length != 0)
            {
                Console.WriteLine("Press Q to inject the cheat!");
                string key = Console.ReadKey().Key.ToString();
                if (key.ToUpper() == "Q")
                    Console.Clear();
                    Console.WriteLine("Cheat is Injected! Please wait until you hear the beep!");
                System.Threading.Thread.Sleep(5000);
                Console.Beep();
                Console.Clear();
                Console.WriteLine("You can now close the cheat");
                System.Threading.Thread.Sleep(100);
                Console.WriteLine("Press the MiddleMouse button to open the menu!");
                Console.Read();

            }
            else
            {
                Console.WriteLine("Rust is NOT OPEN! Please open RUST and reopen the cheat!");
                Console.Read();

          
            }
        }
    }
}


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by ѕнα∂σωJul 5, 2014 07:59 AM 7 188 Jul 5, 2014 07:59 AM
Last Post: Templar.Clown
[.NET] by Malcolm˞˞˞˞˞˞˞˞˞˞˞˞˞˞˞˞˞˞Jun 7, 2014 06:50 PM 49 2,803 Jun 7, 2014 06:50 PM
Last Post: Crypt3d_C0d3r
[C#] by ᴺᴼᴬᴴFeb 10, 2014 09:00 PM 5 207 Feb 10, 2014 09:00 PM
Last Post: 0xDEAD10CC