0

I want to make a windows form application that I can open multiple times.

When I click the "GO" button on the first form, I want the mouse to perform a series of clicks within the form (given by specific coordinates), while I still have control over the cursor using my hand-held mouse, so essentially there are 2 mice.

If I click the "GO" button on all forms, I want all the mice to perform a series of clicks within the corresponding form (all running in unison, not effecting one another), while I still have control over the hand-held mouse to do what I want I.E. browse the web.

Is this possible to do? IF so where would I start?

Jon B
  • 51,025
  • 31
  • 133
  • 161

2 Answers2

0

You can use PInvoke and call the SendInput API. http://www.pinvoke.net/default.aspx/user32.sendinput

Wolfgang Ziegler
  • 1,675
  • 11
  • 23
0

To the best of my knowledge it is impossible to have two mice on one windows system, if you simulate a click somewhere it normally moves the mouse to that location.

You can try the lib Wolfgang suggested or you can use the code from this question

As for it running multiple times you could just load up multiple threads all running the same code, like this:

    static void Main(string[] args)
    {
        Thread[] threads = new Thread[5]; // replace 5 with how many times you want to run it.
        for(int i = 0; i < threads.Length;i++)
        {
            threads[i] = new Thread(new ThreadStart(MyCode));
            threads[i].Start();
        }
    }

    static void MyCode()
    {
        //put code here
    }
Community
  • 1
  • 1
Alex L
  • 390
  • 1
  • 3
  • 14