[源码依次]c#完成windows远程桌面连接依次代码

  • A+
所属分类:织梦网
摘要

//远程连接小白源码资源站接中间方法privateAxMSTSCLib.AxMsRdpClient7rdpc=null;protectedvoidOnCreateControl(){rdpc=newAxMSTSCL

//远程连接小白源码资源站http://www.526bt.com/account?__preferral=41b2453033.2042接中间方法
private AxMSTSCLib.AxMsRdpClient7 rdpc=null;
protected void OnCreateControl()
{
rdpc =new AxMSTSCLib.AxMsRdpClient7();
rdpc.OnDisconnected +=new AxMSTSCLib.IMsTs小白源码资源站http://www.526bt.com/account?__preferral=41b2453033.2042scAxEvents_OnDisconnectedEventHandler(rdpc_OnDisconnected);
this.Controls.Add(rdpc);
rdpc.Dock = DockStyle.Fill;
rdpc.BringToFront();
}

void rdpc_OnDisconnected(object sender, AxMSTSCLib.IMsTscAxEvents_OnDisconnectedEvent e)
{
//处理断开连接
}

public void Disconnect()
{
try
{
if (rdpc.Connected==1)
{
rdpc.Disconnect();
}
}
catch (Exception)
{

}

}

private void SetRdpClientProperties(Machine parMachine)
{
rdpc.Server = parMachine.MachineName;
rdpc.AdvancedSettings2.RDPPort = parMachine.Port;
rdpc.UserName = parMachine.UserName;
rdpc.Domain = parMachine.DomainName;
if (parMachine.Password !="")
{
rdpc.AdvancedSettings5.ClearTextPassword = parMachine.Password;
}
rdpc.AdvancedSettings5.RedirectDrives = parMachine.ShareDiskDrives;
rdpc.AdvancedSettings5.RedirectPrinters = parMachine.SharePrinters;
rdpc.ColorDepth =(int)parMachine.ColorDepth;
}

public void Connect(Machine parMachine)
{
SetRdpClientProperties(parMachine);
rdpc.Connect();
}

//远程主机设备
[Serializable()]
public class Machine
{
private string _RemoteDesktopConnectionName;
public string RemoteDesktopConnectionName
{
get { return _RemoteDesktopConnectionName; }
set { _RemoteDesktopConnectionName= value; }
}

private string _MachineName;
public string MachineName
{
get { return _MachineName; }
set { _MachineName= value; }
}
private string _DomainName;
public string DomainName
{
get { return _DomainName; }
set { _DomainName= value; }
}

private string _UserName;
public string UserName
{
get { return _UserName; }
set { _UserName= value; }
}

private string _Password;
public string Password
{
get { return _Password; }
set { _Password= value; }
}

private bool _AutoConnect;
public bool AutoConnect
{
get { return _AutoConnect; }
set { _AutoConnect= value; }
}

private bool _ShareDiskDrives;
public bool ShareDiskDrives
{
get { return _ShareDiskDrives; }
set { _ShareDiskDrives= value; }
}

private bool _SharePrinters;
public bool SharePrinters
{
get { return _SharePrinters; }
set { _SharePrinters= value; }
}

private bool _SavePassword;
public bool SavePassword
{
get { return _SavePassword; }
set { _SavePassword= value; }
}

private Colors _ColorDepth;
public Colors ColorDepth
{
get { return _ColorDepth; }
set { _ColorDepth= value; }
}

public int Port
{
get
{
return _Port;
}

set
{
_Port = value;
}
}

private int _Port;

public enum Colors
{
HighColor15 =15,
HighColor16 =16,
Color256 =8,
TrueColor =24
}
}

分享当前页面将至少获得10%佣金,点此获取推广链接(规则说明)。

本站VIP源码资源永久免费下载!持续更新!www.526bt.com

加入999永久VIP会员带做项目包赚钱!教引流包搭建,社群资源共享!

新项目更新通知QQ群:767688774 站长技术交流QQ群:552760713

点击这里给我发消息

  • 我的微信
  • 这是我的微信扫一扫
  • weinxin
  • 我的微信公众号
  • 我的微信公众号扫一扫
  • weinxin
微 信 运 行 任 意 链 接
苹果签名200一月!不掉的苹果企业签名
最新版影视APP仿乐尚视界/橙子/聚合影视/苹果IOS安卓版 苹果签名内部价
支付通道搭建、支付接口搭建、承接各种支付项目

发表评论

您必须才能发表评论!