Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am working i a project display more than Pcs in one monitor , i found 3 solutions but each one has a problem , the first one when i log by the application via RDP the user is logged out , what i want to be sharing and display small image for the desktop and when i click gives me a big screen
my question now how can i log in without logged of the other ?

What I have tried:

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);
            }
        }
    }
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900