Я только что попытался сделать программу на C#, используя RDP с кодом ниже, но что-то пошло не так. Когда он запускается, я получаю сообщение о подключении к другому P C, но когда я его принимаю, RDP-клиент в моей форме ничего не делает (я имею в виду, что он все еще пуст). Что я делаю неправильно? Или этого кода недостаточно для него?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MSTSCLib;
namespace RDP_Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
axMsRdpClient31.Server = server_Text.Text;
axMsRdpClient31.UserName = login_Text.Text;
IMsTscNonScriptable secure = (IMsTscNonScriptable)axMsRdpClient31.GetOcx();
secure.ClearTextPassword = password_Text.Text;
axMsRdpClient31.Connect();
}
catch
{
MessageBox.Show("Error", $"Connection Error {server_Text.Text}", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void button2_Click(object sender, EventArgs e)
{
try
{
if (axMsRdpClient31.Connected.ToString() == "1")
axMsRdpClient31.Disconnect();
}
catch
{
MessageBox.Show("Error", $"Connection Error {server_Text.Text}", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}