如何使用C#控制LAN中另一台计算机的键盘和鼠标 [英] How to Control keyboard and mouse of another Computer in a LAN using c#

查看:340
本文介绍了如何使用C#控制LAN中另一台计算机的键盘和鼠标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的先生,

在我的项目中,我想通过在局域网中使用我的计算机的鼠标和键盘来控制另一台计算机的键盘和鼠标.有没有办法通过使用c#编码来做到这一点.所以请帮我做.


谢谢
Sujith T.P

Dear Sir,

In my project i want to control keyboard and mouse of another computer by using my computer''s mouse and keyboard in a LAN. Is there any way to do that by using c# coding. So please help me to do that.


Thanks
Sujith T.P

推荐答案

即使这是一个坏主意,当然也可以.

您控制的计算机应充当网络服务器,而您的控制计算机应充当客户端,服务器应客户端的请求在其本地计算机上执行键盘和鼠标输入.

因此,您可以在服务器主机上开发和安装一些用作网络服务的Windows Service.

为了模拟键盘和鼠标输入,请使用P/Invoked Windows API SendInput:我如何将byte []发送到另一台PC [ ^ ],
在局域网上与两个Windows应用程序进行通信. [^ ].

对于Windows Service的开发,请从此处开始: http://msdn.microsoft .com/en-us/library/y817hyb6%28v = VS.100%29.aspx [
Even though this is a bad idea, certainly there is a way.

You controlled computer should act as a network server, and your controlling computer — as a client, the server performing keyboard and mouse input on its local computer by request from a client.

Therefore, you can develop and install on a server host some Windows Service working as a network service.

For simulation of keyboard and mouse input, use P/Invoked Windows API SendInput: http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310%28v=vs.85%29.aspx[^].

For networking, you can use sockets, classical remoting or WPF, self-hosted by your Windows Service. Please see my overview of these approaches in my past solutions:
how i can send byte[] to other pc[^],
Communication b/w two Windows applications on LAN.[^].

For development of Windows Service, start here: http://msdn.microsoft.com/en-us/library/y817hyb6%28v=VS.100%29.aspx[^].

—SA


这篇关于如何使用C#控制LAN中另一台计算机的键盘和鼠标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆