使用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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为除非您只是将光标定位在您自己的应用程序上,否则您必须使用 Windows api 调用。您可以在 C# 中引用它:
有更完整的 Win32 包装类的源代码 此处
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:
There's source code for a more complete Win32 wrapper class here
您必须编写一个在远程计算机上运行的客户端应用程序来接收鼠标移动命令消息。然后,该客户端应用程序将控制鼠标,并将其移动到命令的坐标。
有多种应用程序允许远程桌面控制。 Microsoft 至少提供了几种(网络会议、远程桌面)。 VNC 是另一个流行的工具。 Joel 的 CoPilot 是基于 VNC 构建的。
You will have to write a client application that us run on the remote machine to receive your mouse movement command messages. That client application will then take control of the mouse, and move it to commanded coordinates.
There are several applications that allow remote desktop control. Microsoft supplies at least a couple (Netmeeting, Remote Desktops). VNC is another popular tool. Joel has his CoPilot built on VNC.