Although Windows comes with a remote desktop connection, we want to integrate the remote desktop into our own software, do some secondary development work, manage remote servers in batches, etc.
The renderings are as follows:
Remote desktop core library
Windows system comes with remote desktop activex dll, directory:
Such libraries cannot be called directly using C# and need to be converted using AxImp.exe.
Windows Forms ActiveX Control Importer (Aximp.exe)
The ActiveX Control Importer converts type definitions from the COM type library of ActiveX controls into Windows Forms controls.
Windows Forms can only host Windows Forms controls, which are classes that derive from Control. Aximp.exe Generate wrapping classes that can be hosted on ActiveX controls on Windows Forms. This allows you to use the same design-time support and programming methodology that can be applied to other Windows Forms controls.
To host an ActiveX control, a wrapper that derives from AxHost must be generated. This wrapper control contains an instance of the underlying ActiveX control. It knows how to communicate with ActiveX controls, but it shows up as Windows Forms controls. This build control hosts the ActiveX control and exposes its properties, methods, and events as the properties of the build control.
The command is as follows:
The final result is a :AxMSTSCLib.dll, MSTSCLib.dll file
Create a new RemotePlus .NET 4.7.2 WinForm project and reference the two dlls after generation. (MSTSCLib.dll Need to set the embedding interop type to false)
Create a new frmLogin.cs form, which is mainly filled in server address, account, password, and other information.
The filled remote desktop information is eventually passed to the main form.
The main codes are as follows:
Finally, attach the source code:
Tourists, if you want to see the hidden content of this post, please Reply
|