RemoteDesktopClient object

[RemoteDesktopClient is no longer available for use as of Windows 10 and Windows Server 2016 Technical Preview.]

Provides the methods and properties needed to configure and use the Remote Desktop Protocol (RDP) app container client control.

Members

The RemoteDesktopClient object has these types of members:

  • Events
  • Methods
  • Properties

Events

The RemoteDesktopClient object has these events.

Event Description
OnAdminMessageReceived

Called when the client control receives an administrative message.

OnAutoReconnected

Called when the client control has automatically reconnected to a remote session.

OnAutoReconnecting

Called when the client control attempts to automatically reestablish a connection to a remote session.

OnConnected

Called when the client control has connected to a remote session.

OnConnecting

Called when the client control attempts to establish a connection to a remote session.

OnDialogDismissed

Called after a dialog box displayed by the client control is dismissed.

OnDialogDisplaying

Called before the control displays a dialog box.

OnDisconnected

Called when the client control has been disconnected from a remote session.

OnKeyCombinationPressed

Called when special key combinations are pressed in the remote session.

OnLoginCompleted

Called when the client control has successfully logged on to a remote session.

OnNetworkStatusChanged

Called when the network status has changed.

OnRemoteDesktopSizeChanged

Called when the remote desktop size has changed.

OnStatusChanged

Called when the client control has updated its status.

OnTouchPointerCursorMoved

Called when the touch pointer cursor has moved and the EventsEnabled property is set to true.

 

Methods

The RemoteDesktopClient object has these methods.

Method Description
Connect

Initiates a connection by using the properties currently set on the RDP app container client control.

DeleteSavedCredentials

Deletes saved credentials for the specified remote computer.

Disconnect

Disconnects the active connection.

Reconnect

Initiates an automatic reconnection of the RDP app container client control to fit the session to the new width and height.

 

Properties

The RemoteDesktopClient object has these properties.

Property Access type Description

Actions

Read-only

Retrieves the actions object for the RDP app container client.

Settings

Read-only

Retrieves the settings object for the RDP app container client.

TouchPointer

Read-only

Contains the RemoteDesktopClientTouchPointer object for the RDP app container client.

 

Examples

The following code example, from the Remote Desktop app container client sample, demonstrates how to instantiate and initialize the RemoteDesktopClient object.

createClientControl: function (desktopWidth, desktopHeight) {
    // Initialize RDP client control.
    // Create object element.
    var clientControlObject = document.createElement("object");

    // Register for ActiveX events.
    clientControlObject.addEventListener("readystatechange", function (e) {
        if (clientControlObject.readyState !== 4) {
            WinJS.log && WinJS.log("Error: ActiveX control readyState is not 4. ReadyState: " + clientControlObject.readyState, "sample", "error");
        }
    }, false);

    clientControlObject.addEventListener("error", function (e) {
        WinJS.log && WinJS.log("Error in loading the ActiveX control", "sample", "error");
    }, false);

    // Set object's classid to RDP client control's s CLSID.
    clientControlObject.classid = "CLSID:EAB16C5D-EED1-4E95-868B-0FBA1B42C092";
    
    clientControlObject.id = "clientControl";

    // Set object's height and width.
    clientControlObject.width = desktopWidth;
    clientControlObject.height = desktopHeight;

    // Add the element to  DOM.
    var clientControlRegion = document.getElementById("clientControlRegion");
    clientControlRegion.appendChild(clientControlObject);

    return clientControlObject;
},

The following code example, from the Remote Desktop app container client sample, demonstrates how to define and add various event handlers for the RemoteDesktopClient object.

function attachEventListeners () {
    myClientControlObject.attachEvent("OnConnecting", function () {
        displayEventNotification("OnConnecting: Attempting to establish connection to the remote PC.", true);
    });

    myClientControlObject.attachEvent("OnConnected", function () {
        displayEventNotification("OnConnected: Client control has connected to the remote PC.", true);
    });

    myClientControlObject.attachEvent("OnLoginCompleted", function () {
        displayEventNotification("OnLoginCompleted: Successfully logged on to the remote PC.", true);
    });

    myClientControlObject.attachEvent("OnDialogDisplaying", function () {
        displayEventNotification("OnDialogDisplaying: A dialog message is being displayed by the client control.", true);
    });

    myClientControlObject.attachEvent("OnDialogDismissed", function () {
        displayEventNotification("OnDialogDismissed: Dialog message shown by the client control is dismissed.", true);
    });

    myClientControlObject.attachEvent("OnDisconnected", function (disconnectReason, extendedDisconnectReason, disconnectErrorMessage) {
        displayEventNotification("OnDisconnected: Client control has been disconnected from the remote PC.", true);
        displayEventNotification("Disconnect reason: " + disconnectReason);
        displayEventNotification("Extended disconnect reason: " + extendedDisconnectReason);
        displayEventNotification("Disconnect error message: " + disconnectErrorMessage);

        // Remove the control and reset the connection button.
        Microsoft.Sample.RDPClient.removeClientControl(myClientControlObject);
        connectButton.innerText = "Connect";
    });

    myClientControlObject.attachEvent("OnNetworkBandwidthChanged", function (qualityInfo, bandwidth, rtt) {
        displayEventNotification("OnNetworkBandwidthChanged: Network bandwidth information has been changed.", true);
        displayEventNotification("Network bandwidth quality: " + translateQualityInfoCode(qualityInfo));
    });

    myClientControlObject.attachEvent("OnStatusChanged", function (statusCode, statusMessage) {
        displayEventNotification("OnStatusChanged: Connection status has been changed.", true);
        displayEventNotification("Status message: " + statusMessage);
    });

    myClientControlObject.attachEvent("OnRemoteDesktopSizeChanged", function (width, height) {
        displayEventNotification("OnRemoteDesktopSizeChanged: Remote PC's desktop size has been changed.", true);
        displayEventNotification("Width: " + width + ", Height: " + height);
    });
}

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

End of client support

Windows 8.1

End of server support

Windows Server 2012 R2

IDL

RdpAppContainerClient.idl

Type library

MsTscAx.dll

DLL

MsTscAx.dll

IID

CLSID_RemoteDesktopClient is defined as EAB16C5D-EED1-4E95-868B-0FBA1B42C092