C# 远程控制 源码

lucky749 2008-10-14 09:33:26
跪求C# 远程控制 源码 .
有资料也可以.
...全文
193 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
myxker 2010-05-22
  • 打赏
  • 举报
回复
网上多的是啊
lucky749 2008-10-14
  • 打赏
  • 举报
回复
我不可以用wmi.因为有些端口客户并不肯开给我使用.
wartim 2008-10-14
  • 打赏
  • 举报
回复
用wmi干这个不是很轻松的事么
lucky749 2008-10-14
  • 打赏
  • 举报
回复
回复 fanzhonglei
并非是调用WMI来实现远程控制的
fanzhonglei 2008-10-14
  • 打赏
  • 举报
回复

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Management;
namespace CloseComputer
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

public void CloseComputer(string strname, string strpwd, string ip, string doinfo)
{
ConnectionOptions op = new ConnectionOptions();
op.Username = strname;//连接电脑用户名 我不明白这个用户名 是本机计算机名称 还是远程计算机名称 怎么获取
op.Password = doinfo;//连接电脑密码
ManagementScope scope = new ManagementScope("\\\\" + ip + "\\root\\cimv2", op);
try
{
scope.Connect();
System.Management.ObjectQuery oq = new System.Management.ObjectQuery("SELECT * FROM Win32_OperatingSystem");
ManagementObjectSearcher query1 = new ManagementObjectSearcher(scope, oq);
//得到WMI控制
ManagementObjectCollection queryCollection1 = query1.Get();
foreach (ManagementObject mobj in queryCollection1)
{
string[] str ={ "" };
mobj.InvokeMethod(doinfo, str);
}
MessageBox.Show("操作成功");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void button1_Click(object sender, EventArgs e)
{
CloseComputer(this.textBox2.Text.Trim(), this.textBox3.Text.Trim(), this.textBox1.Text.Trim(), "Shutdown");
}
}
}
greystar 2008-10-14
  • 打赏
  • 举报
回复
网上自己找一下,应该有这方面,

110,537

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧