This example changes the effect of the F12 key in a VT terminal session. It interrupts the original transmission and sends alternate data (the string "test" for this example) to the host.
Private Sub Session_BeforeTerminalKey(Key As Long, Continue As Boolean)
'Check to see if F12 was the key pressed
If Key = rcVtF12Key Then
'Transmit alternate data
Session.Transmit "test"
'Cancel the original transmission
Continue = False
End If
End Sub
This example is designed for use with HP host applications that use F8 to exit. The event procedure puts up a confirmation dialog box when F8 is pressed. If the user clicks No, the keystroke is not transmitted to the host.
Private Sub Session_BeforeTerminalKey(Key As Long, Continue As Boolean)
'Check to see if F8 was the key pressed
If Key = rcHpF8Key Then
'Display a confirmation dialog box
If MsgBox("Exit?", vbYesNo) = vbNo Then
'Cancel the transmission if the user clicks No
Continue = False
End If
End If
End Sub