 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
lossev Master Cheater
Reputation: 0
Joined: 12 Jan 2007 Posts: 296 Location: Sweden
|
Posted: Thu Dec 04, 2008 5:52 am Post subject: C# auto clicker [help] |
|
|
Hi, im trying to make an auto clicker in c# but im stuck, i dont know what else to try, (its in windows form application).
Here's what ive manage to do, can anyone help me out?
(im not that good of a coder yet, im still just learning).
To make the code work you have to add the controls used ofc.
| Code: |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace autoclicker
{
public partial class Form1 : Form
{
MouseEventArgs auto;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void mouse(MouseButtons button)
{
OnMouseClick(auto);
System.Threading.Thread.Sleep(10);
}
private void button1_Click(object sender, EventArgs e)
{
mouse(MouseButtons.Left);
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
auto = new MouseEventArgs(MouseButtons.Right, 1, MousePosition.X, MousePosition.Y, 0);
}
}
}
|
thanks for helping me
_________________
Oreo's and milk  |
|
| Back to top |
|
 |
Fronzel Grandmaster Cheater Supreme
Reputation: 0
Joined: 07 Feb 2008 Posts: 1099 Location: Nexons backyard
|
Posted: Thu Dec 04, 2008 7:43 am Post subject: |
|
|
I would use sendmessaage, you can send mousebutton down and up with it using:
| Code: |
WM_LBUTTONDOWN = 0x201, //Left mousebutton down
WM_LBUTTONUP = 0x202, //Left mousebutton up
|
Here's an example to click the button "5" in windows calculator:
| Code: | IntPtr hwnd = FindWindow("SciCalc", "Calculator");
IntPtr fiveKey = FindWindowEx(hwnd, IntPtr.Zero, "Button", "5");
SendMessage(fiveKey, (int)WMessages.WM_LBUTTONDOWN, 0, 0);
SendMessage(fiveKey, (int)WMessages.WM_LBUTTONUP, 0, 0);
|
define findwindow like this:
| Code: |
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindowEx(IntPtr hwndParent,
IntPtr hwndChildAfter,
string lpszClass,
string lpszWindow
);
|
_________________
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Thu Dec 04, 2008 7:59 am Post subject: |
|
|
also can be done by using mouse_event API
look up at msdn for more info
|
|
| Back to top |
|
 |
lossev Master Cheater
Reputation: 0
Joined: 12 Jan 2007 Posts: 296 Location: Sweden
|
Posted: Thu Dec 04, 2008 8:17 am Post subject: |
|
|
thanks guys
_________________
Oreo's and milk  |
|
| Back to top |
|
 |
yoyonerd Grandmaster Cheater
Reputation: 0
Joined: 26 Apr 2008 Posts: 699 Location: -->formerly yoyonerd<--
|
Posted: Sun Dec 07, 2008 12:38 pm Post subject: |
|
|
did sendmessage actually work?
wait, is this for maplestory? cuz i think the only way for maplestory is to use postmessage
_________________
|
|
| 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
|
|