dragonboy
dragonboy

Reputation: 33

How to make a screen share application

I am trying to make a simple screen share application in C# and found this guide: https://www.c-sharpcorner.com/uploadfile/ulricht/how-to-create-a-simple-screen-sharing-application-in-C-Sharp/ and followed it but it doesn't work i tried it on the same computer and on two different PCs but nothing seems to work

//Host
public partial class ScreenShareHandler : Form
    {
        RDPSession x = new RDPSession();
        public ScreenShareHandler()
        {
            InitializeComponent();
        }

        private void ScreenShareHandler_Load(object sender, EventArgs e)
        {
        }


        private void Incoming(object Guest)
        {
            IRDPSRAPIAttendee MyGuest = (IRDPSRAPIAttendee)Guest;//???
            MyGuest.ControlLevel = CTRL_LEVEL.CTRL_LEVEL_INTERACTIVE;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            x.OnAttendeeConnected += Incoming;
            x.Open();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            IRDPSRAPIInvitation Invitation = x.Invitations.CreateInvitation("Trial", "MyGroup", "", 10);
            textBox1.Text = Invitation.ConnectionString;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            x.Close();
            x = null;
        }
    }


//Client
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            string Invitation = textBox1.Text;// "";// Interaction.InputBox("Insert Invitation ConnectionString", "Attention");
            axRDPViewer1.Connect(Invitation, "User1", "");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            axRDPViewer1.Disconnect();
        }
}

Upvotes: 0

Views: 768

Answers (1)

Joelius
Joelius

Reputation: 4329

As written in my comments:

Have you hooked up the eventhandlers correctly? If you click on the button in the designer you can go to the Events Tab in the Property-window and check if the Click-event points to the right eventhandler. Another way to check if the correct handler is used is to put a breakpoint inside each handler. Then debug and check if you get into the right method when you click the button. If not you didn't hook up the Eventhandlers correctly.

Upvotes: 2

Related Questions