InfoConnect VBA Guide
Attachmate.Reflection.Objects.Emulation.IbmHosts Library / BeforeSendControlKeyEventHandler Event
The source of the event.
Control Key.
ExampleExample
In This Topic
    BeforeSendControlKeyEventHandler Event
    In This Topic
    Handles the BeforeSendControlKey event to permit users to modify a control key value or cancel a send control key action before it is sent.

    To cancel the action, set the Cancel property of the BeforeSendControlKeyEventArgs object passed to the event handler to true.

    Syntax
    Public Delegate Function BeforeSendControlKeyEventHandler( _
       ByVal sender As Object, _
       ByRef key As Integer _
    ) As Boolean

    Parameters

    sender
    The source of the event.
    key
    Control Key.

    Return Value

    A boolean value that determines whether the event is cancelled.

    If set to false (the default), the event is cancelled and the key is not sent to the host.

    If set to true, the key is sent to the host.

    Example
    This sample captures the screen before the control key is sent and appends it to a text file.
    Private Function IbmScreen_BeforeSendControlKey(ByVal sender As Variant, key As Long) As Boolean
        Dim screenRows As Integer
        Dim screenColumns As Integer
        Dim fnum As Integer
        Dim screenShot As String
        screenRows = ThisIbmScreen.rows
        screenColumns = ThisIbmScreen.columns
     
        'Get all the text on the screen
        screenShot = ThisIbmScreen.GetTextEx(1, 1, screenRows, screenColumns, GetTextArea_Block, _
        GetTextWrap_Off, GetTextAttr_Any, GetTextFlags_CRLF)
       
        'Add a line to separate each screen
        screenShot = screenShot & "................................................................................"
       
        'Open a file and append the screenshot to the file
        path = ThisIbmTerminal.SessionFilePath & ".log"
        fnum = FreeFile()
        Open path For Append As fnum
        Print #fnum, screenShot
        Close #fnum
        
        Debug.Print path
       
        IbmScreen_BeforeSendControlKey = True
    End Function
    See Also