Hello i am learning to program using C# i want to write my first ever program i guess im jumping in at the deep end but i like it like this
i am trying to block an application from running its a cheat program for legend of mir called DBT3 i have the code to kill it but people can just restart the program
-
using System;
-
using System.Collections.Generic;
-
using System.ComponentModel;
-
using System.Data;
-
using System.Drawing;
-
using System.Text;
-
using System.Windows.Forms;
-
using System.Diagnostics;
-
-
namespace WindowsApplication1
-
{
-
public partial class Form1 : Form
-
{
-
public Form1()
-
{
-
InitializeComponent();
-
}
-
-
private void button1_Click(object sender, EventArgs e)
-
{
-
Process[] ps = Process.GetProcessesByName("DBT3");
-
-
foreach (Process pr in ps)
-
{
-
pr.Kill();
-
pr.Close();
-
}
-
}
-
}
-
}
-
i dont know how to block it from coming up again or can i place a timer on it and then re exacute the Kill function?
many thanks if u can solve my problem
well ya, a simple timer would work, like set it to a really less interval rate, like maybe 1000, or 2000. like copy the button1 click event into a the timer_tick sub, after you drag a timer onto the form in designer mode, which will, by default, be named 'timer1'.
so the code should just be like this *not tested*
-
private void timer1_Tick(object sender, EventArgs e)
-
{
-
Process[] ps = Process.GetProcessesByName("DBT3");
-
-
foreach (Process pr in ps)
-
{
-
pr.Kill();
-
pr.Close();
-
}
-
}
(now you have to double click the timer icon in designer mode for it to set its handle to timer1_tick, hope i helped.