Option Compare Database
Option Explicit
Dim objExtraSystem As ExtraSystem
Dim objExtraSessions As ExtraSessions
Dim objExtraSession As ExtraSession
Dim objExtraScreen As ExtraScreen
Dim objExtraArea As ExtraArea
Private Sub Class_Initialize()[green]
'Connect to an active Extra instance[/green]
Set objExtraSystem = CreateObject("Extra.System")
If objExtraSystem Is Nothing Then
MsgBox "Could not create an Extra System Object" & Chr(13) & "because there is no mainframe session open", vbCritical, "Capture Error"
Exit Sub
End If[green]
'Establish a Sessions collection for objExtraSystem[/green]
Set objExtraSessions = objExtraSystem.Sessions
If objExtraSessions Is Nothing Then
MsgBox "Could not create an Extra Sessions Object"
Set objExtraSystem = Nothing
Exit Sub
End If[green]
'Append objExtraSystem.ActiveSession to objExtraSessions[/green]
Set objExtraSession = objExtraSystem.ActiveSession
If objExtraSession Is Nothing Then
MsgBox "Could not create an Extra Session object"
Set objExtraSessions = Nothing
Set objExtraSystem = Nothing
Exit Sub
End If
If Not objExtraSession.Visible Then objExtraSession.Visible = True[green]
'Establish a Sreen Object[/green]
Set objExtraScreen = objExtraSession.Screen
If objExtraScreen Is Nothing Then
MsgBox "Could not create an Extra Screen object"
Set objExtraSession = Nothing
Set objExtraSessions = Nothing
Set objExtraSystem = Nothing
Exit Sub
End If
End Sub
Private Sub Class_Terminate()
Set objExtraSession = Nothing
Set objExtraSessions = Nothing
Set objExtraSystem = Nothing
End Sub
Public Property Get ConnectionDetails() As String
Dim strTestResult As String
strTestResult = "Extra System Object " & objExtraSystem.Name & Chr(13)
strTestResult = strTestResult & "Extra Sessions Object " & objExtraSessions.Count & Chr(13)
strTestResult = strTestResult & "Extra Session Object " & objExtraSession.FullName
ConnectionDetails = strTestResult
End Property
Public Sub MoveNext()
objExtraScreen.SendKeys ("<Home>")
objExtraScreen.WaitHostQuiet (0)[green]
'In my world F8 scrolls down so [i]1<PF8>[/i] will scroll 1 line[/green]
objExtraScreen.SendKeys ("1<PF8>")
objExtraScreen.WaitHostQuiet (0)
End Sub
Public Property Get CurrentLineText(StartRow As Integer, StartColumn As Integer, StopRow As Integer, StopColumn As Integer) As String
Set objExtraArea = objExtraScreen.Select(StartRow, StartColumn, StopRow, StopColumn)
CurrentLineText = objExtraArea.Value
End Property
Public Property Get SessionActive() As Boolean
If objExtraSystem Is Nothing Then
SessionActive = False
ElseIf objExtraSessions Is Nothing Then
SessionActive = False
ElseIf objExtraSession Is Nothing Then
SessionActive = False
Else
SessionActive = True
End If
End Property
Public Property Get HostBusy() As Boolean
If objExtraScreen.OIA.XStatus = 5 Then
HostBusy = True
Else
HostBusy = False
End If
End Property