共用方式為


RDPSession class

The RDPSession class includes the IRDPSRAPISharingSession, IRDPSRAPISharingSession2, and the _IRDPSessionEvents interfaces.

RDPSession has these types of members:

Events

The RDPSession class has these events.

Event Description
OnApplicationClose Called when an application closes.
OnApplicationOpen Called when a new application is created.
OnApplicationUpdate Called when the shared property on the application object is changed.
OnAttendeeConnected Called when an attendee connects to the session.
OnAttendeeDisconnected Called when an attendee disconnects from the session.
OnAttendeeUpdate Called when one of the property values for an attendee changes.
OnChannelDataReceived Called when data is received from an attendee.
OnChannelDataSent Called when data is sent to the client.
OnConnectionAuthenticated Called when the connection is authenticated.
OnConnectionEstablished Called when a connection to the server is established.
OnConnectionFailed Called when the client fails to connect to the server.
OnConnectionTerminated Called when the client's connection to the server is closed.
OnControlLevelChangeRequest Called when a viewer requests control.
OnControlLevelChangeResponse Called in response to a viewer requesting control.
Windows Server 2012 R2, Windows 8.1, Windows Server 2012, Windows 8, Windows Server 2008 R2, Windows 7, Windows Server 2008 and Windows Vista: This event is not supported before Windows 10 and Windows Server 2016.
OnError Called when a critical error occurs in the session.
OnFocusReleased Called when the shared top-level window has gained or lost focus.
OnGraphicsStreamPaused Called when the graphics stream has been paused.
OnGraphicsStreamResumed Called when the graphics stream has been resumed.
OnSharedDesktopSettingsChanged Called when a shared desktop setting changes.
OnSharedRectChanged Called when the size of the shared top-level window of the application changes.
OnViewingSizeChanged Called when the viewer cropping size has changed.
OnWindowClose Called when a sharable top-level window is closed.
OnWindowOpen Called when a sharable top-level window is created by an application.
OnWindowUpdate Called when one of the properties on the Window object changes.

Methods

The RDPSession class has these methods.

Method Description
Close Puts the session in an inactive state, closes all attendees, and stops listening to new incoming connections.
ConnectToClient Connects the viewer from the sharer in reverse connect mode if the viewer cannot connect to the sharer because of a network issue. For example, the viewer may not be able to connect to the sharer because of network address translation (NAT).
ConnectUsingTransportStream Connects using the specified transport stream.
Windows Server 2012 R2, Windows 8.1, Windows Server 2012, Windows 8, Windows Server 2008 R2, Windows 7, Windows Server 2008 and Windows Vista: This method is not supported before Windows 10 and Windows Server 2016.
GetDesktopSharedRect Retrieves the rectangle of the sharer's virtual desktop.
Open Puts the session in an active state and starts listening to incoming connections.
Pause Pauses the encoding of the sharer's desktop to pause sending graphics updates to all viewers.
Resume Resumes the encoding of the sharer's desktop to resume sending graphics updates to all viewers.
SendControlLevelChangeResponse Sends an OnControlLevelChangeResponse event.
Windows Server 2012 R2, Windows 8.1, Windows Server 2012, Windows 8, Windows Server 2008 R2, Windows 7, Windows Server 2008 and Windows Vista: This method is not supported before Windows 10 and Windows Server 2016.
SetDesktopSharedRect Sets the rectangle of the sharer's virtual desktop to be shared.

Properties

The RDPSession class has these properties.

Property Access type Description
ApplicationFilter
Read-only
An object implementing the IRDPSRAPIApplicationFilter interface.
Attendees
Read-only
An object implementing the IRDPSRAPIAttendeeManager interface.
ColorDepth
Read/write
The color depth of the session.
FrameBuffer
Read-only
The IRDPSRAPIFrameBuffer interface for the session.
Windows Server 2012 R2, Windows 8.1, Windows Server 2012, Windows 8, Windows Server 2008 R2, Windows 7, Windows Server 2008 and Windows Vista: This property is not supported before Windows 10 and Windows Server 2016.
Invitations
Read-only
An object implementing the IRDPSRAPIInvitationManager interface.
Properties
Read-only
An object implementing the IRDPSRAPISessionProperties interface.
VirtualChannelManager
Read-only
An object implementing the IRDPSRAPIVirtualChannelManager interface.

Remarks

The version-independent ProgID is "Rdpcomapi.RDPSession" and the version-specific ProgID is "Rdpcomapi.RDPSession.1".

Requirements

Minimum supported client
Windows Vista [desktop apps | UWP apps]
Minimum supported server
Windows Server 2008 [desktop apps | UWP apps]
Header
RdpEncomAPI.h
IDL
RdpEncomAPI.idl
Type library
RdpEncomAPI.tlb
DLL
RdpEncom.dll
CLSID
CLSID_RDPSession is defined as 9B78F0E6-3E05-4A5B-B2E8-E743A8956B65

See also

Windows Desktop Sharing Classes

IRDPSRAPISharingSession

IRDPSRAPISharingSession2

_IRDPSessionEvents