开发者

Control the mouse cursor using C#

I'm trying to write a program using C# that would all开发者_如何学JAVAow 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!


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);

There's source code for a more complete Win32 wrapper class here


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜