The following example displays a message based on whether a connection has occurred or not. DemoDefineConnectedEvent is run first to define the event. DemoCheckConnectedEvent can then be run to check if the event has occurred or not.
Public myEvent as Integer
Sub DemoDefineConnectedEvent ()
With Session
'Define an event to watch for a new connection
.DefineEvent rcNextEvent, rcEvConnected, "", "", 1, 1, 1
myEvent = .EventDefined
End With
End Sub
Sub DemoCheckConnectedEvent ()
With Session
'Check for the event and display a message box
'based on the result.
If .CheckEventNumber(myEvent) Then
MsgBox "A connection has been made."
Else
MsgBox "No Connection has been made yet."
End If
End With
End Sub