Anıl Canlı
Anıl Canlı

Reputation: 434

how to get mouse position in windows and auto-click somewhere

I want to write a program in C# like Ghost-Mouse or auto-clicker. It will find the mouse location in windows and click there as i instructed. The question is, What code should I write to find specific mouse x and y locations and click globally. Can I get a sample code please? Thanks in advance.

Upvotes: 0

Views: 1067

Answers (1)

Ravindra Bagale
Ravindra Bagale

Reputation: 17673

get position by

MousePosition.X
   MousePosition.Y

example:

private void pictureBox1_Click(object sender, EventArgs e)
    {
        MessageBox.Show(string.Format("X: {0} Y: {1}", MousePosition.X, MousePosition.Y));
    }

Upvotes: 1

Related Questions