 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Odecey Master Cheater
Reputation: 1
Joined: 19 Apr 2007 Posts: 259 Location: Scandinavia
|
Posted: Wed Jun 04, 2008 10:26 am Post subject: Task manager block |
|
|
Hi, I read up on how to kill a running process a few days ago, and decided to make a task manager block out of it. This is the code:
| Code: |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Diagnostics;
using System.Windows.Forms;
namespace NoFirefox // Tried it with firefox first lol
{
public partial class Form1 : Form
{
bool buttonCheck = false;
bool buttonCheck2 = true;
private Process[] processes;
private string procName = "taskmgr";
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (buttonCheck)
{
buttonCheck = false;
label1.ForeColor = Color.Black;
label1.Text = "Not active";
button1.Text = "Enable";
}
else
{
buttonCheck = true;
label1.ForeColor = Color.DarkSeaGreen;
label1.Text = "Ready";
button1.Text = "Disable";
}
}
private void button2_Click(object sender, EventArgs e)
{
if (buttonCheck)
if (buttonCheck2)
{
timer1.Enabled = true;
label1.ForeColor = Color.DarkOrange;
label1.Text = "Active";
button2.Text = "Deactivate";
buttonCheck2 = false;
}
else
{
timer1.Enabled = false;
buttonCheck2 = true;
buttonCheck = false;
label1.ForeColor = Color.Black;
label1.Text = "Not active";
}
else
{
MessageBox.Show("Enable before activating.");
}
}
private void timer1_Tick(object sender, EventArgs e)
{
processes = Process.GetProcessesByName(procName);
try
{
foreach (Process proc in processes)
{
proc.Kill();
}
}
catch (System.NullReferenceException)
{
// If no task manager is running while the program is active, do the following:
}
}
}
}
|
Designer generated code:
| Code: |
this.components = new System.ComponentModel.Container();
this.button1 = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.label1 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(18, 12);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(54, 23);
this.button1.TabIndex = 0;
this.button1.Text = "Enable";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// timer1
//
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(49, 47);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Not active";
//
// button2
//
this.button2.Location = new System.Drawing.Point(78, 12);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(54, 23);
this.button2.TabIndex = 2;
this.button2.Text = "Activate";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(155, 79);
this.Controls.Add(this.button2);
this.Controls.Add(this.label1);
this.Controls.Add(this.button1);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form1";
this.Text = "Task Manager Block";
this.ResumeLayout(false);
this.PerformLayout();
|
Is there any way someone can still open task manager without tampering with the program (While its activated of course)?
Edit: Forgot to mention that this is in C#.
Last edited by Odecey on Wed Jun 04, 2008 10:42 am; edited 1 time in total |
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Wed Jun 04, 2008 10:31 am Post subject: |
|
|
First of all, no one really needs the Designer code, because it doesn't matter. Second, learn to name your buttons, it helps with reading the code. For example:
Instead of
| Code: |
private void button1_Click(object sender, EventArgs e)
|
you have
| Code: |
private void btnKill_Click(object sender, EventArgs e)
|
or something.
~~
As for your question, I believe someone could just rename the .exe, but I have no idea. _________________
|
|
| Back to top |
|
 |
Odecey Master Cheater
Reputation: 1
Joined: 19 Apr 2007 Posts: 259 Location: Scandinavia
|
Posted: Wed Jun 04, 2008 10:34 am Post subject: |
|
|
I guess i never really saw the need since im usually the only one looking at the code, but i might aswell since its so easy anyway.
Edit: Thanks for replying =). |
|
| Back to top |
|
 |
--Pillboi-- Grandmaster Cheater Supreme
Reputation: 0
Joined: 06 Mar 2007 Posts: 1383 Location: I don't understand the question. Is this a 1 to 10 thing?
|
Posted: Wed Jun 04, 2008 11:36 am Post subject: |
|
|
You should always keep your code tidy and organised, or when you come to write a slightly bigger program, you will get extremely confused and it will take you three times the time it would take you otherwise.  _________________
Enter darkness, leave the light, Here be nightmare, here be fright...
Earth and Water, Fire and Air. Prepare to meet a creature rare.
Enter now if you dare, Enter now the dragon's lair. |
|
| Back to top |
|
 |
Trow Grandmaster Cheater
Reputation: 2
Joined: 17 Aug 2006 Posts: 957
|
Posted: Wed Jun 04, 2008 9:34 pm Post subject: |
|
|
That reminds me, you can stop an executable from running if you opened the exe in "Binary Lock Read" mode or whatever equivalent in C#.
(Funny things happen if you close taskmgr, hide your own window and open taskmgr in BLR!) _________________
Get kidnapped often. |
|
| Back to top |
|
 |
Estx Expert Cheater
Reputation: 0
Joined: 04 Mar 2008 Posts: 172
|
Posted: Thu Jun 05, 2008 12:49 am Post subject: |
|
|
| blland wrote: | | That reminds me, you can stop an executable from running if you opened the exe in "Binary Lock Read" mode or whatever equivalent in C#. [...] |
| Code: | string taskMgr = Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\taskmgr.exe";
if (System.IO.File.Exists(taskMgr))
System.IO.File.Open(taskMgr, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.None); |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|