RemoteTextConnection Class

Definition

Represents a connection between a Remote Desktop client application and the local computer's text input system. This connection can be used to enable text input virtualization.

public ref class RemoteTextConnection sealed : IClosable
/// [Windows.Foundation.Metadata.Activatable(Windows.System.RemoteDesktop.Input.IRemoteTextConnectionFactory, 851968, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 851968)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class RemoteTextConnection final : IClosable
/// [Windows.Foundation.Metadata.Activatable(Windows.System.RemoteDesktop.Input.IRemoteTextConnectionFactory, 851968, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 851968)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(Windows.System.RemoteDesktop.Input.IRemoteTextConnectionFactory2, 1048576, "Windows.Foundation.UniversalApiContract")]
class RemoteTextConnection final : IClosable
[Windows.Foundation.Metadata.Activatable(typeof(Windows.System.RemoteDesktop.Input.IRemoteTextConnectionFactory), 851968, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 851968)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class RemoteTextConnection : System.IDisposable
[Windows.Foundation.Metadata.Activatable(typeof(Windows.System.RemoteDesktop.Input.IRemoteTextConnectionFactory), 851968, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 851968)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.System.RemoteDesktop.Input.IRemoteTextConnectionFactory2), 1048576, "Windows.Foundation.UniversalApiContract")]
public sealed class RemoteTextConnection : System.IDisposable
function RemoteTextConnection(connectionId, pduForwarder)
function RemoteTextConnection(connectionId, pduForwarder, options)
Public NotInheritable Class RemoteTextConnection
Implements IDisposable
Inheritance
Object Platform::Object IInspectable RemoteTextConnection
Attributes
Implements

Windows requirements

Device family
Windows 11 (introduced in 10.0.22000.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v14.0)

Remarks

RemoteTextConnection is designed to enable text input virtualization with remote applications integrated with a local desktop. This scenario is called Remote Programs or Remote Applications Integrated Locally (RAIL). Using RemoteTextConnection with full desktop remoting is not currently recommended and may result in undesirable behavior. When text input virtualization is enabled, built-in input methods provided by Windows (including IMEs) can be used for entering text in remote applications.

To enable text input virtualization, a Remote Desktop client application creates one RemoteTextConnection object for each remote session it connects to. Data packets are delivered through this object to and from the local computer's text input system in the following ways:

  • The text input system sends data packets to the Remote Desktop client application via the RemoteTextConnectionDataHandler delegate. The Remote Desktop client application is responsible for creating this delegate and passing it to the RemoteTextConnection constructor. The data packets from the text input system will conform to the RDP text input virtualization protocol. Messages received on this delegate will arrive on a background thread. When the client application receives data packets from the delegate, it should forward the packets to the remote RAIL server via the unidirectional, client-to-server Dynamic Virtual Channel (DVC) for virtualized text input. This DVC is named TextInput_ClientToServerDVC.

  • The Remote Desktop client application also needs to listen for data packets from the remote machine on the server-to-client text input DVC (named TextInput_ServerToClientDVC) and forward those data packets to the local computer's text input system via the ReportDataReceived method. For more information about how Remote Desktop client applications support DVCs, see Dynamic Virtual Channel (DVC) and the tsvirtualchannels.h header file.

The only local input methods that RemoteTextConnection will integrate with remote applications are built-in input methods provided by Windows that use the next version of the Text Services Framework (including IMEs). These input methods are hosted by the text input system in a centralized process making integration feasible. Older Text Services Framework version 1 or IMM IMEs are not hosted in a centralized process and are not supported by text input virtualization. These older input methods must be installed directly on a remote system in order to work with applications remoted from that system. This is the same way Text Services Framework version 1 and IMM input methods are utilized when text input virtualization is not used.

Constructors

RemoteTextConnection(Guid, RemoteTextConnectionDataHandler)

Creates a new instance of the RemoteTextConnection class specific to one remote session.

RemoteTextConnection(Guid, RemoteTextConnectionDataHandler, RemoteTextConnectionOptions)

Properties

IsEnabled

Specifies whether text input virtualization is enabled for the Remote Desktop connection serviced by this RemoteTextConnection instance.

Methods

Close()

Closes the RemoteTextConnection object.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

RegisterThread(UInt32)

Registers a thread on which the Remote Desktop client application will present remote UI.

ReportDataReceived(Byte[])

Forwards a data packet received over the TextInput_ServerToClientDVC Dynamic Virtual Channel (DVC) to the local machine’s text input service.

ReportPredictedKeyEvent(UInt16, RemoteKeyEventAttributes)
UnregisterThread(UInt32)

Unregisters a thread registered via RegisterThread when cleaning up, or when that thread will no longer host remote UI.

Applies to

See also