控制使用C#鼠标光标 [英] Control the mouse cursor using C#
问题描述
我想写使用C#程序,让我来取远程Windows机器上对鼠标的控制。这将允许我发出命令来将鼠标移动到屏幕的某一部分,并然后在屏幕的该部分。我在想,如果有任何的C#类,我将是实现这一目标很有用。任何帮助表示赞赏。谢谢!
I'm trying to write a program using C# that would allow me to remotely take control of the mouse on a windows machine. This would allow me to issue commands to the mouse to move to a certain part of the screen and then click on that part of the screen. I was wondering if there were any C# classes that I would be useful in achieving this goal. Any help is appreciated. Thanks!
推荐答案
我想,除非你只是将光标放在自己的应用程序,你必须使用一个Windows API调用。您可以参考,在C#这样:
I think unless you're just positioning the cursor over your own application, you have to use a windows api call. You can reference that in C# as such:
[DllImport("user32")]
public static extern int SetCursorPos(int x, int y);
有源代码更完整的Win32包装类的here
There's source code for a more complete Win32 wrapper class here
这篇关于控制使用C#鼠标光标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!