Member 14593733 Ответов: 0

Изменение размера rdpviewer для совместного использования экрана C#


я работаю я проект отображения более чем ПК в одном мониторе , я нашел 3 решения , но каждый из них имеет проблему , первый, когда я войти в приложение через RDP пользователь вышел из системы, то, что я хочу быть общим и отображать небольшое изображение для рабочего стола и когда я нажимаю дает мне большой экран
мой вопрос теперь: как я могу войти в систему, не войдя в систему другого ?

Что я уже пробовал:

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
     
        public Form1()
        {
            InitializeComponent();
        }

        private void txtPort_TextChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                rdp.Server = textBox1.Text;
                rdp.UserName = textBox2.Text;

                System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping();
                System.Net.NetworkInformation.PingReply pingReply = ping.Send(rdp.Server);
                if (pingReply.Status == IPStatus.Success)
                {
                    IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx();
                    secured.ClearTextPassword = textBox3.Text;
                    
                    rdp.Connect();
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show("Error Connecting RDC", "Error connecting to remote desktop " + textBox1.Text + " Error: " + Ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            try
            {
                rdp2.Server = textBox1.Text;
                rdp2.UserName = textBox2.Text;

                System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping();
                System.Net.NetworkInformation.PingReply pingReply = ping.Send(rdp2.Server);
                if (pingReply.Status == IPStatus.Success)
                {
                    IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp2.GetOcx();
                    secured.ClearTextPassword = textBox3.Text;
                    rdp2.Connect();
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show("Error Connecting RDC", "Error connecting to remote desktop " + textBox1.Text + " Error: " + Ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                // Check if connected before disconnecting
                if (rdp.Connected.ToString() == "1")
                    rdp.Disconnect();
            }
            catch (Exception Ex)
            {
                MessageBox.Show("Error Disconnecting", "Error disconnecting from remote desktop " + textBox1.Text + " Error: " + Ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    }
}

0 Ответов