Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Terminal Object / Connecting Event
Example
In This Topic
Connecting Event
In This Topic
This event is triggered immediately before a connection is made.
Syntax
private Sub Terminal_Connecting ( 
   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.
Example
This example displays the connection type in a YESNO message box and allows users to decide whether to connect.
'To run this example, copy it to the ThisTerminal code window
Private Function Terminal_Connecting(ByVal sender As Variant, ByVal ConnectionID As Long, ByVal connnectionType As Attachmate_Reflection_Objects_Emulation_OpenSystems.ConnectionTypeOption, ByVal connectionSettings As Variant) As Boolean
           
    Dim msg As String 'the message to include in the dialog box
    
    'Get the connection type and include it in the message
    Select Case connectionType
    
        Case ConnectionTypeOption_None
            msg = "There is no connection currently configured. Do you want to connect?"
        
        Case ConnectionTypeOption_BestNetwork
            msg = "The connection type is " & "BestNetwork? " & "Do you want to connect?"
    
        Case ConnectionTypeOption.ConnectionTypeOption_SecureShell
            msg = "The connection type is " & "SecureShell? " & "Do you want to connect?"
    
        Case ConnectionTypeOption.ConnectionTypeOption_Telnet
            msg = "The connection type is " & "Telnet? " & "Do you want to connect?"
        
        Case ConnectionTypeOption.ConnectionTypeOption_VT_MGR
            msg = "The connection type is " & "VT_MGR. " & "Do you want to connect?"
        
        Case Else
        msg = "Do you want to connect?"
      
    End Select
    
    'Display a message box and get the user response
    confirm = MsgBox(msg, vbYesNo)
 
    'Depending on the response, allow or disallow connecting
    If confirm = vbYes Then
 
        Terminal_Connecting = True
 
    Else
 
        Terminal_Connecting = False
 
    End If
 
End Function
See Also