samedi 16 février 2019

WinForms, checkbox if statement execution

I'm trying to execute a class when the checkbox is checked but that wasn't working so I now am trying to execute within the checkbox1. here's what I have so far.

I have tried using a class and doing something like AutoInjector.cs

AutoInjector AI = new AutoInjector();

then I tried using it like this.

checkbox1.checked()
{
  Run(AI);
}

here is what i have right now

private void checkBox1_CheckedChanged(object sender, EventArgs e)
    {
        if (checkBox1.Checked)
        {
            public partial class App : System.Windows.Application
    {
        ExploitAPI api = new ExploitAPI();
        public bool IsProcessOpen(string name)
        {
            foreach (Process clsProcess in Process.GetProcesses())
            {
                if (clsProcess.ProcessName.Contains(name))
                {
                    return true;
                }
            }

            return false;
        }

        protected override void OnStartup(StartupEventArgs e)
        {
            // Get Reference to the current Process
            Process thisProc = Process.GetCurrentProcess();

            if (IsProcessOpen("RobloxPlayerBeta.exe") == false)
            {
                System.Windows.MessageBox.Show("Roblox not open!");
            }
            else
            {
                // Check how many total processes have the same name as the current one
                if (Process.GetProcessesByName(thisProc.ProcessName).Length > 0)
                {
                    // If ther is more than one, than it is already running.
                    //System.Windows.MessageBox.Show("Already Injected.");
                    //return;
                    api.LaunchExploit();
                }

                base.OnStartup(e);
            }
        }
    }
}
        else if (!checkBox1.Checked)
        {
            //nothing here..
        }
    }

nothing works of course... error error error




Aucun commentaire:

Enregistrer un commentaire