Welcome to MSDN Blogs Sign in | Join | Help

Windows Desktop Sharing API

Windows Desktop Sharing API Basics

Microsoft Terminal Services provides a public "Windows Desktop Sharing API" based on RDP to enable customers to write custom collaboration solutions in Windows Vista. These API's are available on all the SKU's starting with Windows Vista Home Basics. You can write a customized collaboration application that can do either or all kinds of sharing including desktop, application and region.  Useful MSDN documentation of these API's is available at:

http://msdn2.microsoft.com/en-us/library/aa373852.aspx

Highlights:

Windows desktop sharing is a multi-party screen sharing technology in Windows Vista, wherein a local desktop can be transmitted over an RDP connection without creating an additional session.

  • a) Connectivity: Windows Desktop Sharing does support connectivity to intelligent appliances, wireless devices and PC's in uPnP framework and also teredo tunneling to provide connectivity to IPV6 machines behind IPV4 NAT's.
  • b) Reverse Connect: It is an interesting feature, where sharer can connect to the viewer if viewer cannot reach the sharer via direct connect. For example, the viewer may not be able to connect to the sharer because of network address translation (NAT).
  • c) Authentication: API supports creating tickets/ invitations on the sharer side that can be routed by the API consumer application or IM's to the viewers.
  • d) Sharing Modes: API supports sharing desktop, application or a region.
  • e) Control Modes: Sharer always has full control of his desktop/ application/region. Each viewer can be tuned to no-view/view or interactive control. Sharer controls the control level for each viewer and viewers can request promotion in control level to sharer.
  • f) Smart sizing: Smart sizing is well-supported and is a client/ viewer option that can be turned on and off.
  • g) Virtual channels: Virtual channels can be used to exchange other data like documents, application data, chat messages etc.

Microsoft Collaboration Solutions:

"Windows Meeting Space" and "Remote Assistance" in Windows Vista are based on these public API's -

  • a) Remote Assistance: Remote assistance is 1:1 sharing mechanism wherein the helper (expert) can get to see and control novice's desktop. Application and region sharing is not exposed via RA in Windows Vista.
  • b) Windows Meeting Space: Windows Meeting Space is a peer-to-peer application that enables multiple users to conduct virtual meeting. Participants can share their desktop, documents and applications, exchange notes, give presentations by connecting to a network projector. Network projector in this scenario is a intelligent device in uPnP framework that plays a role of viewer.

API support versus perceived limitations in Windows Meeting Space:

  • a) Multi-monitor remoting - In Windows Meeting Space the sharer does not allow sharing of both or the secondary monitor in multi-monitor arrangement. However, the API allows you to attach the appropriate region of the composite monitor and hence it can be flexible enough to share any particular monitor, if needed. It could get very interesting with more than 2 monitors.
  • b) Easy Switching among desktop/ application sharing - "Windows Meeting Space" doesn't allow flexible switching between desktop and application sharing. You need to select either one of them. To switch you need to restart the session (Meeting Space session). The API allows you to switch between various sharing methods without closing the session.
  • c) Application Sharing (minimize->on-screen) - In "Windows Meeting Space" when the viewer has the control of the sharer's application and viewer minimizes the application then he/she doesn't have a way to work on that application further (until sharer clicks on the taskbar on the minimized application). The API does provide a way for the viewer to bring back the minimized application on desktop. Hence a better user experience can be provided on the viewer side.

Frequently Asked Questions:

  1. What is the behavior with DWM?
    Windows desktop sharing API turns off "Desktop Windows Manager/ DWM" on the sharer's machine when the desktop/ application sharing is active.  
  2. What is the behavior when "Secure Desktop" pops up while sharing?
    "Pause screen- Black screen with two bars(indicating pause) at lower right" is remoted when secure desktop (UAC prompts) is up on sharer's machine, when sharing process is run as a non-system process. Also, the pause screen is shown if sharer opts to suspend graphics encoding for some reason via IRDPSRAPISharingSession::Pause.
  3. Why does the remoted screen refresh for all connected clients whenever a new viewer joins the session?
    The protocol tries to make sure that the graphics updates sent to all the connected viewers are synchronized. To do so, it needs to refresh the graphics stream for each previously connected client.
  4. Why does sharer's monitor flash while sharing? Is there anything that I can do to avoid multiple set of DWM on/off flashes, typically in 1:M scenarios?
    Currently, the protocol does not support remoting glass so it turns DWM off while sharing. Turning DWM off/ on causes a flash on the sharer's monitor [only in case if DWM was on]. You cannot entirely avoid on/off flash but you can avoid multiple on/off flashes.  Depending on your preference you can select dynamic/ static loading of mirror driver. In static mode, sharer will load mirror driver [& turn DWM off if it is on] only once when it puts a session in active state and unload mirror driver [& turns DWM on if it was on earlier] only once when it puts session in inactive state. So, in static mirror driver load mode you won't see multiple set of DWM on/off flashes. However, note that in static mirror driver load DWM/ glass will be turned off even if there are no clients connected. In dynamic mirror driver load mode DWM/ glass is turned off only when there is at least one connected client and is turned on whenever there are no connected clients. There is a property DrvConAttach that you can set via IRDPSRAPISessionProperties to control this behavior.
  5. Can multiple viewers have simultaneous control of sharer's desktop/ application?
    Yes. Sharer can permit each viewer a none, view only OR interactive control. Of course, viewers input (mouse movements/ keyboard input) will only be directed to sharer's machine when viewer has interactive control and the active X control has focus.
  6. Can you force sharer or viewer[in reverse connect scenario] to use particular port/ protocol for listening for connection and communication?
    Yes. You can use IRDPSRAPISessionProperties property - PortId and PortProtocol to use specific port and protocol.
  7. Why does requesting color depth change from the viewer via IRDPSRAPIViewer::RequestColorDepthChange fail?
    Currently, protocol does not allow viewer to request/ control the color depth change. Only the sharer can control the color depth via put property IRDPSRAPISharingSession::put_ColorDepth. IRDPSRAPIViewer::RequestColorDepthChange returns E_NOTIMPL in the current release.
  8. Does the API support clipboard?
    No. Windows Desktop Sharing API doesn't provide automatic text/ file clipboard solution yet. This might be a good proposal for new feature in future versions.
  9. Does the API support Audio/ Multi-media?
    No audio can be redirected to and fro from viewers/ sharer via "Windows Desktop Sharing API". This might be a good proposal for new feature in future versions.
Published Thursday, March 08, 2007 7:07 PM by termserv

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Jason Conger Blog » Blog Archive » Windows Desktop Sharing RDP API

# Writing a Desktop Sharing Application

Windows Desktop Sharing (WDS) API provides a rich set of API to share your complete desktop or just individual

Friday, March 23, 2007 3:49 PM by Terminal Services Team Blog

# re: Windows Desktop Sharing API

In a application sharing setup, is it possible to share multiple applications/regions located on different monitors (in a multi monitor environment?). They should be displayed on separate "players".

The sharing "host" will toggle sharing on and off on each application. Each application shared should be displayed in its own windows on the "listener".

I succesfully added multiple listerners to a single sharing session, but I was unable to start multiple sharing sessions on the same host. Any pointers?

Tuesday, May 29, 2007 4:37 AM by Pål A.

# re: Windows Desktop Sharing API

You can share multiple applications\windows. However, everything thats shared on a single sharing session is shown on all viewers\attendess of the sharing session. Also you cannot have multiple sharing sessions on a single winlogon session.

Sunday, June 03, 2007 1:46 PM by srneerud

# re: Windows Desktop Sharing API

Using Windows Desktop Sharing via a low bandwidth link. Sometimes the viewer falls behind and even when the sharer stops updating the screen the changes are buffered somewhere and continues to playback in a time-delayed fashion in the viewer.

Is there any way to make this buffer smaller thus make the viewer "skip frames" when falling too far behind the sharer?

Thanks

(Is there a MSDN group for Windows Desktop sharing, or another way to contact the API guys?)

Tuesday, November 13, 2007 7:44 AM by Pål A.

# re: Windows Desktop Sharing API

Is it possible to use the "Windows Desktop Sharing API" also in Windows XP environments ?

Wednesday, November 28, 2007 9:47 AM by Jaime

# RDP API

Do you know of any documented APIs for creating an RDP session (Just like what the RDC Client does ) on Windows 2003, Vista etc ? I do not necessarily want to share an existing session as in this article, but would rather like to create a new session like the way the RDC client does.

Friday, January 25, 2008 10:53 PM by Yogi

# re: Windows Desktop Sharing API

Does Desktop Sharing API will use  Remote Desktop Multi Party Virtual channel extension protocol ( RDPEMC )

EMC Protocol is in the below url.

http://msdn2.microsoft.com/en-us/library/cc242017.aspx

I am trying to view the traffic in the Netmon for RDPEMC

Thursday, February 28, 2008 9:03 AM by Niladri

# re: Windows Desktop Sharing API

I created a small experimental app based on this API.

http://www.turboirc.com/rdp

I am looking forward to also automate the process for XP.

Sunday, October 05, 2008 3:00 AM by Michael

# re: Windows Desktop Sharing API

We are currently using the Windows Desktop Sharing API in a business software. Will this API still be around in Windows 7? If not we need to start looking for alternatives. Thanks any feedback.

Friday, October 31, 2008 8:49 AM by paaland

# re: Windows Desktop Sharing API

To alleviate your concerns, we currently plan to continue support of the Windows Desktop Sharing API in Windows 7.

Friday, October 31, 2008 6:00 PM by Casey Dvorak [MSFT]

# re: Windows Desktop Sharing API

Check this software it uses teredo to use ur existing IPv4 application(winxp netmeeting,legacy RTC client application  etc ) to work over internet with p2p connectivity..Creates a ipv4 tunnel over  teredo ipv6 tunnel so no need port ur existing application to work over teredo.

http://www.lanoninternet.com

Saturday, November 08, 2008 10:52 AM by peter.moses

# Windows Desktop Sharing API

in my application i have some 4-5 tabs. what i need is on a button click the tab containing the ACtiveX control should be selected and the shared screen should be shown. the problem comes when i click on the button the corresponding tab is shown but gives an error of InvalidStateException. Maybe the ActiveX control needs some time to load .... becz if i am putting a message box there it works fine.

is there some way in which i can wait or check until the control has been loaded.

Wednesday, November 26, 2008 3:36 AM by tarun jindal

# Top 10 RDP Protocol Misconceptions – Part 2

Hi, Nadim here again. Today we’re wrapping up our Top 10 list of RDP Misconceptions. So without further

Friday, March 13, 2009 12:37 AM by Terminal Services Team Blog

# re: Windows Desktop Sharing API

I Will like to know how to scale the shared desktop area to the RDPViewer control in the viewer application so that the viewer does not have to scroll the screen again and again.

Tuesday, April 07, 2009 2:02 AM by Rishabh

# re: Windows Desktop Sharing API

Have you look at the SmartSizing API. Link to the API - http://msdn.microsoft.com/en-us/library/aa373358(VS.85).aspx. It is part of IRDPSRAPIViewer interface,

Tuesday, April 07, 2009 2:52 AM by srneerud

# re: Windows Desktop Sharing API

I'm working on a custom remote access application for Windows XP Embedded. Any plans to support Windows Desktop Sharing API on XPe? If not, can you recommend another solution?

Friday, June 05, 2009 10:26 AM by Eugene

# re: Windows Desktop Sharing API

Same question here: I need to support anything from Windows XP SP2 and up. If RTC is gimped on Vista, and the Vista APIs are not available on XP SP2, then how can I cross-communicate?

I could use RealVNC, or Citrix, or something like that, but it seems Microsoft has enough technologies floating around that this ought to be possible without resorting to that...

Friday, July 17, 2009 7:19 PM by Jon Watte

# re: Windows Desktop Sharing API

Are Desktop Sharing working on Windows 7?

Monday, August 31, 2009 2:21 PM by Donny

# re: Windows Desktop Sharing API

Many people have asked: Yes, remote desktop sharing works on Win7. I have a 64-bit desktop and a 32-bit netbook, both running 7, and using the ActiveX controls for hosting and viewing.

However, when I click the "control desktop" button in the sample application, and then click in the viewing control, it just beeps at me; it doesn't actually let me share control. The hosting application does receive the request, and does assign "Control" level access in the event handler.

Why does this not work as advertised?

Also, why can't I get access to the RDP stream at a lower level? I'd really like to be able to get the bitmap data directly (because I'm rendering to something that's not the screen), and I'd really like to be able to inject mouse and keyboard events directly (because I'm using input devices that are not the physical devices).

As it is, I'm trying to host the ActiveX control and use IViewObject to Draw() into an offscreen bitmap, and it's not working out very well so far...

Sunday, September 13, 2009 5:59 PM by Jon Watte

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker