Using RDPViewer from Win32


  • I'm trying to use the RDPViewer class (IRDPSRAPIViewer and friends) from Win32 with the RDPSession sample in C# found on the Terminal Services (now Remote Desktop services) team blog.

    I have a session hosting application that is the same as the sample they have posted. It is running, and sharing, and printing out an invitation XML document.

    I instantiate the RDPViewer in the ActiveX Test Container application. Then I go to "Invoke Method," I select "Connect," and I enter the invitation XML, a name, and the appropriate password as arguments. In the event logger in the test container application, I first see this:

    RDPViewer Class: OnSharedDesktopSettingsChanged {width=388}{height=329}{colordepth=16}

    I then called RequestControl(), passing 2. After a while longer, I get:

    RDPViewer Class: OnConnectionTerminated {discReason=2308}{ExtendedInfo=0}

    The ActiveX control is staying stubbornly white during the entire time.

    Interestingly, the breakpoints I have in the OnAttendeeConnected, OnControlLevelChangeRequest or OnAttendiDisconnected functions are not getting hit, so something seems to be going wrong even before that level.

    Both machines are running Windows 7 RTM; one is 32-bit, one is 64-bit.

    I'm looking for a few things here:

    1) Does anyone have more experience with these COM classes? The documentation, from a Win32 point of view, is... sparse.
    2) Is what I'm doing intended to work? Are you seeing anything that totally wouldn't work?
    3) Have you successfully used these components, so I know that it's at least possible to do what I want?

    XNA/DirectX MVP 2006-present
    Sunday, September 13, 2009 5:25 AM

All replies

  • I have some more information.

    1) When I run the C# sample as-is, it connects between the two machines. However, when I use the "control desktop" button, and then click in the viewer pane, it just beeps at me; it doesn't control the remote machine. (The remote machine did get the request, and did assign the control level property, yet it doesn't seem to take effect)

    2) When re-running the experiment above, I instead get the following output within the ActiveX control test container application:
    RDPViewer Class: OnSharedDesktopSettingsChanged {width=420}{height=290}{colordepth=16}
    RDPViewer Class: OnSharedDesktopSettingsChanged {width=1024}{height=600}{colordepth=16}
    RDPViewer Class: OnConnectionEstablished
    RDPViewer Class: OnConnectionTerminated {discReason=3}{ExtendedInfo=768}

    So... what's discReason 3? Which API should I go look up to start trying to figure that out?

    XNA/DirectX MVP 2006-present
    Sunday, September 13, 2009 8:47 PM