Reference: Remote Desktop using C#.net
Reference documents: Tscform.zip
This blog is mainly about how to use the Microsoft Terminal Services Client ActiveX Control in the. NET platform to achieve Remote Desktop access.
Practice:
1. Add a reference in Visual Studio, add the Microsoft Terminal Services Control Type Library in COM, and this process will add MSTSCLib.dll to the project 。
2. Add controls to the toolbar, right-click on the toolbar to select "Select items ...", select "Microsoft Terminal Services Client Control" in the COM component, and the corresponding controls will appear, then drag to use.
3. Implementation code: AXMSTSCAXNOTSAFEFORSCRIPTING1 is the name of the control, Str_computer is the IP address, Str_username is the user name, Str_password is the password.
Axmstscaxnotsafeforscripting1.server = Str_computer; Axmstscaxnotsafeforscripting1.username = Str_username; Imstscnonscriptable secured = (imstscnonscriptable) axmstscaxnotsafeforscripting1.getocx (); Secured. Cleartextpassword = Str_password; Axmstscaxnotsafeforscripting1.connect ();
"205" C # for Remote Desktop access