Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Terminal Object / UserDisconnecting Event
Example
UserDisconnecting Event
This event is triggered before Reflection disconnects from the host.
Syntax
private Sub Terminal_UserDisconnecting ( 
   ByVal sender As Object, _
   ByVal connectionId As Integer, _
   ByVal connectionType As ConnectionTypeOption, _
   ByVal connectionSettings As Object _
) As Boolean

Parameters

sender
An object.
connectionId
An integer.
connectionType
The type of connection.This is a ConnectionTypeOption Enumeration.
connectionSettings
An object.
Remarks
For this event to occur, the user must terminate a connection using Reflection (for example, using the Disconnect button on the Session tab). It will not occur when the user ends a session by using a host log out command.

When a VT/Regis document is closed either programmatically or manually, the event is not cancellable. (If the Cancel flag is set in the event arguments, it is ignored.)

Example
This example opens a dialog box that prompts to choose whether to disconnect when the user disconnects from a session.
'To run this sample, copy it to the ThisTerminal code window
Private Function Terminal_UserDisconnecting(ByVal sender As Variant, ByVal ConnectionID As Long, ByVal connnectionType As Attachmate_Reflection_Objects_Emulation_OpenSystems.ConnectionTypeOption, ByVal connectionSettings As Variant) As Boolean
 
 If MsgBox("End this session?", vbYesNo) = vbYes Then
    Terminal_UserDisconnecting = True
 Else
    Terminal_UserDisconnecting = False
 End If
 
End Function
See Also