looking for editable, C# autoclicker

Posts 1–3 of 3 · Page 1 of 1
looking for editable, C# autoclicker
If someone can make one or send me a code snippet that would be fine too.
Google your post title... https://www.google.com/search?q=c%23+auto+clicker

First Result: Auto Clicker C# - CodeProject

[DllImport("user32")]
public static extern int SetCursorPos(int x, int y);

The next API simulates mouse events (left/right click down/up, wheel EXE)

private const int MOUSEEVENTF_MOVE = 0x0001; /* mouse move */
private const int MOUSEEVENTF_LEFTDOWN = 0x0002; /* left button down */
private const int MOUSEEVENTF_LEFTUP = 0x0004; /* left button up */
private const int MOUSEEVENTF_RIGHTDOWN = 0x0008; /* right button down */

DllImport("user32.dll",
CharSet = CharSet.Auto,CallingConvention=CallingConvention.S tdCall)]
public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons,
int dwExtraInfo);

To simulate one click, you need to use this method twice: the first time for down click and the second time for up click. On the save side, wait 100 milliseconds between moving new location and the click, like in the following code:

SetCursorPos(action.X, action.Y)
Thread.Sleep(100);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
2 parts to this code:

1) moving the cursor (you don't need winAPI for that...just use Cursor.Position = new point(x,y) if you want)
2) clicking the cursor (see mouse_event API)


 
edit

How hard did you look...

http://www.mpgh.net/forum/250-c-prog...-test-app.html

^^Still on first page of C# section
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us