首页 > Windows开发 > 详细

【205】C#实现远程桌面访问

时间:2016-05-16 12:25:33      阅读:527      评论:0      收藏:0      [点我收藏+]

参考:Remote Desktop using C#.NET

参考文件:TscForm.zip

        本博客主要是讲述怎样用 .NET 平台中 Microsoft Terminal Services Client ActiveX control 来实现远程桌面的访问。

做法:

1. 在 Visual Studio 中添加引用,添加 COM 中的 “Microsoft Terminal Services Control Type Library”,这个过程将会把 MSTSCLib.dll 添加到项目中。

技术分享

2. 在工具栏中添加控件,在工具栏上右键选择“选择项...”,将 COM 组件中的 “Microsoft Terminal Services Client Control” 选中,确定后就会有相应的控件出现,然后拖拽就可以使用了。

技术分享

技术分享

3. 实现代码:axMsTscAxNotSafeForScripting1 为控件的名称,str_computer 为 IP 地址、str_userName 为用户名、str_password 为密码。

    axMsTscAxNotSafeForScripting1.Server = str_computer;
    axMsTscAxNotSafeForScripting1.UserName = str_userName;
    IMsTscNonScriptable secured = (IMsTscNonScriptable)axMsTscAxNotSafeForScripting1.GetOcx();
    secured.ClearTextPassword = str_password;
    axMsTscAxNotSafeForScripting1.Connect();

 

【205】C#实现远程桌面访问

原文:http://www.cnblogs.com/alex-bn-lee/p/5497470.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!