I want the cursor to click at the spot where it is set. How would i make it click at where the position is (x,y).
So far i have this:
Code:int x = int.Parse(xText.Text);
int y = int.Parse(yText.Text);
SetCursorPos(x,y);
Printable View
I want the cursor to click at the spot where it is set. How would i make it click at where the position is (x,y).
So far i have this:
Code:int x = int.Parse(xText.Text);
int y = int.Parse(yText.Text);
SetCursorPos(x,y);
make a button on the forum and execute that code :)
so when u type this :
int x = int.Parse(xText.Text);
int y = int.Parse(yText.Text);
SetCursorPos(x,y);
what happens?
Use the left click function/method... this should be a no brainer
Main.cs
Mouse.csCode:using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Bounty;
namespace CursorSet
{
public partial class Form1 : Form
{
Mouse MyMouse = new Mouse();
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int x = int.Parse(textBox1.Text);
int y = int.Parse(textBox2.Text);
Cursor = new Cursor(Cursor.Current.Handle);
Cursor.Position = new Point(x, y);
MyMouse.SendDoubleClick();
}
}
}
tell me if it worksCode:using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace Bounty
{
public class Mouse
{
[DllImport("user32.dll")]
private static extern void mouse_event(UInt32 dwFlags, UInt32 dx, UInt32 dy, UInt32 dwData, IntPtr dwExtraInfo);
private const UInt32 MouseEventLeftDown = 0x0002;
private const UInt32 MouseEventLeftUp = 0x0004;
public void SendDoubleClick()
{
mouse_event(MouseEventLeftDown, 0, 0, 0, new System.IntPtr());
mouse_event(MouseEventLeftUp, 0, 0, 0, new System.IntPtr());
mouse_event(MouseEventLeftDown, 0, 0, 0, new System.IntPtr());
mouse_event(MouseEventLeftUp, 0, 0, 0, new System.IntPtr());
}
}
}
Main.cs
Code:using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Bounty;
namespace CursorSet
{
public partial class Form1 : Form
{
Mouse MyMouse = new Mouse();
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int x = int.Parse(textBox1.Text);
int y = int.Parse(textBox2.Text);
Cursor = new Cursor(Cursor.Current.Handle);
Cursor.Position = new Point(x, y);
MyMouse.SendDoubleClick();
// Send as many strings as u want, it will type where the cursor
// is pointed at
///////////////////////////////////////////////////////////////
SendKeys.Send("BountyHunter Rules");
/////////////////////////////////////////////////////////////////
}
}
}
Thanks alot, really helped me. Kinda new to c#, so this is a bit confusing to me.
Does it work ?
anything else u need ?
note ... havent opened C# for like 5 months lol