What you'll need
A host application, and a viewer application.
The host
C#
private void Incoming(object Guest)
{
IRDPSRAPIAttendee MyGuest = (IRDPSRAPIAttendee)Guest; //???
MyGuest.ControlLevel = CTRL_LEVEL.CTRL_LEVEL_INTERACTIVE;
}- Add reference, rdpcomapi 1.0 Type Library.

- Add using RDPCOMAPILib.
- Add this method.
- Add this class-level variable.
C#
RDPSession x = new RDPSession();
Create three new buttons, and a textbox(don't rename the controls, make use of their default names)
Code
First button
C#
private void button1_Click(object sender, EventArgs e)
{
x.OnAttendeeConnected += Incoming;
x.Open();
}Second button
C#
private void button2_Click(object sender, EventArgs e)
{
IRDPSRAPIInvitation Invitation = x.Invitations.CreateInvitation("Trial", "MyGroup", "", 10);
textBox1.Text = Invitation.ConnectionString;
}Third button
C#
private void button3_Click(object sender, EventArgs e)
{
x.Close();
x = null;
}The viewer
- Right-click on the toolbox and click Choose items.

- In the dialog under COM components, check RDPViewer Class, and click OK.

- Drag and Drop the RDPViewer object onto the form.

Create two new buttons and a textbox.
Code
First button
C#
private void button1_Click(object sender, EventArgs e)
{
string Invitation = textBox1.Text;// "";// Interaction.InputBox("Insert Invitation ConnectionString", "Attention");
axRDPViewer1.Connect(Invitation, "User1", "");
}Second button
C#
private void button2_Click(object sender, EventArgs e)
{
axRDPViewer1.Disconnect();
}How to use
- On the host click button one, the start button
- On the host click button two, and they get the invite button
- On the host copy the text in the text box
- On the viewer paste it into the text box
- On the viewer click button one, the connect button
- To end click the Finish button on either side
Full source code
The viewer
C#
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;
namespace ScrS_viewer_
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
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();
}
private void Form1_Load(object sender, EventArgs e)
{
panel1.Height = Screen.PrimaryScreen.Bounds.Height - 100;
}
}
}The host
C#
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 System.Diagnostics;
using RDPCOMAPILib;
namespace ScrS_server_
{
public partial class Form1 : Form
{
RDPSession x = new RDPSession();
public Form1()
{
InitializeComponent();
}
private void Form1_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;
}
}
}
MuhammadShaheryarkhanPosted Jun 5, 2024, 6:46 AM EDT
Is this work live like on public ip
Himanshu GoelPosted Jun 10, 2020, 10:56 PM EDT
Is it possible to get/shorten the invitation link just like TeamViewer ID in length?
Mohit PannuPosted Apr 26, 2020, 8:45 PM EDT
System.BadImageFormatException HResult=0x8013101B Message=Could not load file or assembly 'Interop.RDPCOMAPILib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
Gyan SinghPosted Nov 27, 2019, 6:01 AM EST
Thanks Its very Helpful and its working proper
Fatih BuralPosted Aug 27, 2018, 12:21 AM EDT
This does not work if you're not connected via RDP already.
Sandeep JadhavPosted Dec 21, 2017, 10:25 PM EST
Can we able to share audio or sound through RdpSession ?? is this possible??
Veronica FernandesPosted Aug 1, 2017, 3:03 AM EDT
What about audio is it possible
Rishi KalalPosted Jul 11, 2017, 7:31 AM EDT
On the viewer I'm unable to see a full screen of host. It is only showing a small part of host. I'm running it on my local machine.
ASHWANI TIWARIPosted May 20, 2017, 2:23 AM EDT
Please tell me why after creating setup through visual studio installer for this application, I am not able to access desktop over different network while we have closed firewall of both system.
Bhushan PawarPosted Nov 25, 2014, 5:20 AM EST
good work..
subhash jdPosted Sep 9, 2014, 11:32 PM EDT
How to configure proxy in it. Because its not working in systems having proxy.
Nikhil ShettyPosted Jan 31, 2014, 9:01 PM EST
hey, can this application be used for remote access
sanjay mishraPosted Nov 20, 2013, 8:45 PM EST
please tell us how to stop aero features when this application running
Mihir TailorPosted Feb 8, 2013, 2:44 AM EST
help!!
Mihir TailorPosted Feb 8, 2013, 2:43 AM EST
not working
sami abdullahPosted Jul 21, 2012, 2:22 PM EDT
thanks
Abid CastanedaPosted Jul 8, 2012, 9:23 PM EDT
Hi, I used your code but it has compilation errors, Guest and Incoming is not declared, can you help me out with that?
kuldeep mecPosted Jul 2, 2012, 9:58 PM EDT
I am trying to "share a single document" just like netmeeting "Share Program", where only one document should be shared at a time to "viewer". If any other "window" popup over the "document" at the "sharer" end then that part should be made "Opaque" at the "Viewer" end (in AxRDPViewer control). If the "document" is minimized at the "Sharer" end whole "AxRDPViewer" should be opaque at the "Viewer" end. Can you please help me out in knowing is there any method or property in AxRDPViewer to do this. Or is there any logic to achieve it. Thanks in advance.
Mahendra YadavPosted Jan 27, 2012, 8:13 PM EST
can i use this post in web application using asp.net
Nirali VoraPosted Sep 6, 2011, 5:18 AM EDT
hi i used your code in silverlight but i have one prob. RDPViewerCalss component dosnt support in silverlight. so i m not able to create viewing application so pls help me out i was stuck from last 3 days
cherry charanPosted Jul 15, 2011, 2:42 AM EDT
It was very useful. but it was not viewing correctly for 64bit systems. I am accessing my laptop(64bit) from My PC(32bit), it looks blur. Can you suggest me to solve this issue.
vovjkee pPosted May 29, 2011, 9:43 AM EDT
haven't you got a similar code with virtual channels via IRDPSRAPIVirtualChannelManager ?
Sujith sPosted Dec 8, 2010, 8:27 PM EST
Hi, can i implement this in an asp.net website will RDPViewer available for aspx page? Thanks Sujith
Ulricht Von SchnellPosted Oct 16, 2010, 9:33 AM EDT
"Creating an instance of the COM component with CLSID {9B78F0E6-3E05-4A5B-B2E8-E743A8956B65} from the IClassFactory failed due to the following error: 800700b7." I just cant find a way to stop this error from occuring. Does anyone know how I can fix this?
Mahesh ChandTOP 10Posted Sep 10, 2010, 8:04 AM EDT
Thank you for sharing. It is very useful.
Ulricht Von SchnellPosted Sep 10, 2010, 4:00 AM EDT
i was searching for what seemed to be forever for a way to share whats displaying on my pc with other pcs connected to the network. So i was determined to post the answer when i figured it out.