sponsored links

Collapse

Announcement

Collapse
No announcement yet.

VB for Apps/PCOM - How to find IP based on autECLSession connections?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • VB for Apps/PCOM - How to find IP based on autECLSession connections?

    Hi,

    I am looking at VB macros connecting to iSeries via the stuff here http://publib.boulder.ibm.com/infoce...t_access08.htm

    I would like to know if you can find the associated IP address that a connection is established to.

    This works to give a list of connections that are established (even if they are signed off) I'd like to add the IP to that ...

    Code:
    Sub SetupConnectionLists()
    Dim autECLConnList As Object    '   List of connections
    Dim SessObj As Object           '   tO ACCESS A SESSION
    Dim NumConns As Long            '   Number of connections
    Dim cNam As String      '   Connection Name
    Dim cHnd As Long        '   Handle ID number
    Dim cTyp As String      '   Connectuon Type
    Dim cCPg As Long        '   Code Page
    Dim cSts As Boolean     '   Status of Started
    Dim cCom As Boolean     '   Status of Communication Started
    Dim cAPI As Boolean     '   Status of API Enabled
    Dim cRdy As Boolean     '   Status of current connection
                            '   [   This indicates whether the emulator window is started, API-enabled, and connected.  ]
                            '   [   This property checks for all three properties. It does NOT mean signed in           ]
    Dim cWin As String      '   Window Text
    Dim x As Integer
    Dim msgtxt As String
    Set autECLConnList = CreateObject("PCOMM.autECLConnList")
    autECLConnList.Refresh
    NumConns = autECLConnList.Count
    For x = 1 To NumConns
        cNam = autECLConnList(x).Name
        cHnd = autECLConnList(x).Handle
        cTyp = autECLConnList(x).ConnType
        cCPg = autECLConnList(x).CodePage
        cSts = autECLConnList(x).Started
        cCom = autECLConnList(x).CommStarted
        cAPI = autECLConnList(x).APIEnabled
        cRdy = autECLConnList(x).Ready
        
        Set SessObj = CreateObject("PCOMM.autECLSession")
        SessObj.SetConnectionByName (cNam)
        cWin = SessObj.autECLWinMetrics.WindowTitle
        
        If cWin = "Fish" Then
            msgtxt = "X[" & x & "] " & _
                    "Handle[" & cHnd & "] " & _
                    "Name[" & cNam & "] " & _
                    "Type[" & cTyp & "] " & _
                    "Code Page[" & cCPg & "] " & _
                    "Started[" & cSts & "] " & _
                    "Connected[" & cCom & "] " & _
                    "API Enabled[" & cAPI & "] " & _
                    "Ready[" & cRdy & "] " & _
                    "Window[" & cWin & "]."
            MsgBox (msgtxt)
        Else
            MsgBox ("Window " & cWin & " declined as not fish.")
        End If
    
    Next x
    End Sub
    Greg Craill: "Life's hard - Get a helmet !!"
Working...
X