Preface: if you are using a Windows Server server, you can find the function of connecting to multiple remote desktops, but you cannot use the XP operating system. The Remote Desktop function uses the mstsc file. In the System32 folder, you can find the mstscax. dll dynamic Connection Library, which is the main component for achieving remote connection. Download a Remote Desktop function written in C # that can connect to multiple Windows servers.
Source code
Http://www.codeproject.com/KB/cs/RemoteDesktopClient.aspx
You can go to the above URL to learn more details.
The left side is a remote list, and the right side is the MDI display area. Multiple Remote interfaces can be displayed.
It is a description of this tool, developed using vs2008 RTM, And the. NET version is 3.5sp1.
Source code analysis
I believe that the most interesting part of this program is the code connecting to the mstsc dynamic link library.
The rdpclient is an object of the axmstsclib. axmsrdpclient type.
The statement is as follows:
Public axmstsclib. axmsrdpclient rdpclient;
Remote connection
Public void connect () // www.elivn.com
{
Status ("starting ...");
Rdpclient. Connect ();
}
Disconnect a remote connection
Public void disconnect ()
{
Status ("disconnecting ...");
Rdpclient. disconnectedtext = "disconnected ";
If (rdpclient. connected! = 0)
{
Rdpclient. Disconnect ();
}
}
Reconnect to a remote object
During the connection, you must specify the server, user name, and password.
Public void reconnect (bool haschanges, bool isfittowindow)
{
Disconnect ();
Status ("waiting for the server to properly disconnect ...");
// Wait for the server to properly disconnect
While (rdpclient. connected! = 0)
{
System. Threading. thread. Sleep (1000 );
Application. doevents ();
}
Status ("reconnecting ...");
If (haschanges)
{
Rdpclient. Server = This. _ ss. server;
Rdpclient. Username = This. _ ss. Username;
Rdpclient. advancedsettings2.cleartextpassword = This. _ ss. Password;
Rdpclient. colordepth = This. _ ss. colordepth;
This. _ isfittowindow = isfittowindow;
If (isfittowindow)
{
Rdpclient. Required topwidth = This. rdpclient. width;
Rdpclient. Required topheight = This. rdpclient. height;
}
Else
{
Rdpclient. Required topwidth = This. _ ss. Required topwidth;
Rdpclient. Required topheight = This. _ ss. Required topheight;
}
Rdpclient. fullscreen = This. _ ss. fullscreen;
}
Connect ();
}
A large number of COM interface functions are used during the connection process.
This program can be used as an important reference for. Net to implement remote desktop.
Preface: if you are using a Windows Server server, you can find the function of connecting to multiple remote desktops, but you cannot use the XP operating system. The Remote Desktop function uses the mstsc file. In the System32 folder, you can find the mstscax. dll dynamic Connection Library, which is the main component for achieving remote connection. Download a Remote Desktop function written in C # that can connect to multiple Windows servers.
Source code
Http://www.codeproject.com/KB/cs/RemoteDesktopClient.aspx
You can go to the above URL to learn more details.
The left side is a remote list, and the right side is the MDI display area. Multiple Remote interfaces can be displayed.
It is a description of this tool, developed using vs2008 RTM, And the. NET version is 3.5sp1.
Source code analysis
I believe that the most interesting part of this program is the code connecting to the mstsc dynamic link library.
The rdpclient is an object of the axmstsclib. axmsrdpclient type.
The statement is as follows:
Public axmstsclib. axmsrdpclient rdpclient;
Remote connection
Public void connect () // www.elivn.com
{
Status ("starting ...");
Rdpclient. Connect ();
}
Disconnect a remote connection
Public void disconnect ()
{
Status ("disconnecting ...");
Rdpclient. disconnectedtext = "disconnected ";
If (rdpclient. connected! = 0)
{
Rdpclient. Disconnect ();
}
}
Reconnect to a remote object
During the connection, you must specify the server, user name, and password.
Public void reconnect (bool haschanges, bool isfittowindow)
{
Disconnect ();
Status ("waiting for the server to properly disconnect ...");
// Wait for the server to properly disconnect
While (rdpclient. connected! = 0)
{
System. Threading. thread. Sleep (1000 );
Application. doevents ();
}
Status ("reconnecting ...");
If (haschanges)
{
Rdpclient. Server = This. _ ss. server;
Rdpclient. Username = This. _ ss. Username;
Rdpclient. advancedsettings2.cleartextpassword = This. _ ss. Password;
Rdpclient. colordepth = This. _ ss. colordepth;
This. _ isfittowindow = isfittowindow;
If (isfittowindow)
{
Rdpclient. Required topwidth = This. rdpclient. width;
Rdpclient. Required topheight = This. rdpclient. height;
}
Else
{
Rdpclient. Required topwidth = This. _ ss. Required topwidth;
Rdpclient. Required topheight = This. _ ss. Required topheight;
}
Rdpclient. fullscreen = This. _ ss. fullscreen;
}
Connect ();
}
A large number of COM interface functions are used during the connection process.
This program can be used as an important reference for. Net to implement remote desktop.