在C#中连接rdp控件时。关联收益2。 2的意思是“控件正在建立连接”
rdp.Server = _server;
rdp.UserName = _username;
rdp.AdvancedSettings2.RDPPort = _port;
Ping ping = new Ping();
PingReply pingReply = ping.Send(rdp.Server);
MessageBox.Show(pingReply?.Status.ToString());
IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx();
secured.ClearTextPassword = _password;
rdp.Connect();
//MessageBox.Show(rdp.);
var txtMessage = "Connected";
if (rdp.Connected == 0)
{
txtMessage = "Not Connected!";
}
if (rdp.Connected == 2)
{
txtMessage = "The control is establishing a connection";
}
MessageBox.Show(txtMessage);