0

我想制作一个可以多次打开的 Windows 窗体应用程序。

当我点击第一个表单上的“GO”按钮时,我希望鼠标在表单内执行一系列点击(由特定坐标给出),而我仍然可以使用我的手持鼠标控制光标,所以基本上有2只老鼠。

如果我在所有表单上单击“GO”按钮,我希望所有鼠标在相应的表单内执行一系列单击(全部一致运行,互不影响),同时我仍然可以控制手持鼠标做我想做的事 IE 浏览网页。

这可能吗?如果是这样,我会从哪里开始?

4

2 回答 2

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
    }
于 2012-07-24T10:44:56.540 回答
0

您可以使用PInvoke和调用SendInputAPI。 http://www.pinvoke.net/default.aspx/user32.sendinput

于 2012-07-24T10:29:15.870 回答