home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / nivb_src / conn.frm < prev    next >
Text File  |  1993-06-03  |  5KB  |  152 lines

  1. VERSION 2.00
  2. Begin Form ConnForm 
  3.    Caption         =   "Connection Services Test"
  4.    Height          =   3630
  5.    Left            =   2280
  6.    LinkMode        =   1  'Source
  7.    LinkTopic       =   "Form1"
  8.    ScaleHeight     =   3225
  9.    ScaleWidth      =   3585
  10.    Top             =   1365
  11.    Width           =   3705
  12.    Begin CommandButton OKButton 
  13.       Caption         =   "&OK"
  14.       Height          =   372
  15.       Left            =   1440
  16.       TabIndex        =   4
  17.       Top             =   2760
  18.       Width           =   732
  19.    End
  20.    Begin ListBox connList 
  21.       Height          =   615
  22.       Left            =   240
  23.       TabIndex        =   9
  24.       Top             =   2040
  25.       Width           =   3135
  26.    End
  27.    Begin Label Label7 
  28.       Caption         =   "Login Time"
  29.       Height          =   252
  30.       Left            =   1680
  31.       TabIndex        =   11
  32.       Top             =   1680
  33.       Width           =   972
  34.    End
  35.    Begin Label Label6 
  36.       Caption         =   "Conn #"
  37.       Height          =   252
  38.       Left            =   240
  39.       TabIndex        =   10
  40.       Top             =   1680
  41.       Width           =   732
  42.    End
  43.    Begin Label Label5 
  44.       Caption         =   "You are connected at:"
  45.       Height          =   252
  46.       Left            =   120
  47.       TabIndex        =   8
  48.       Top             =   1320
  49.       Width           =   2292
  50.    End
  51.    Begin Label socketLabel 
  52.       Height          =   252
  53.       Left            =   1800
  54.       TabIndex        =   7
  55.       Top             =   960
  56.       Width           =   1572
  57.    End
  58.    Begin Label Label4 
  59.       Alignment       =   1  'Right Justify
  60.       Caption         =   "Socket:"
  61.       Height          =   252
  62.       Left            =   600
  63.       TabIndex        =   3
  64.       Top             =   960
  65.       Width           =   852
  66.    End
  67.    Begin Label nodeLabel 
  68.       Height          =   252
  69.       Left            =   1800
  70.       TabIndex        =   6
  71.       Top             =   720
  72.       Width           =   1572
  73.    End
  74.    Begin Label Label3 
  75.       Alignment       =   1  'Right Justify
  76.       Caption         =   "Node:"
  77.       Height          =   252
  78.       Left            =   600
  79.       TabIndex        =   2
  80.       Top             =   720
  81.       Width           =   852
  82.    End
  83.    Begin Label networkLabel 
  84.       Height          =   252
  85.       Left            =   1800
  86.       TabIndex        =   5
  87.       Top             =   480
  88.       Width           =   1572
  89.    End
  90.    Begin Label Label2 
  91.       Alignment       =   1  'Right Justify
  92.       Caption         =   "Network:"
  93.       Height          =   252
  94.       Left            =   600
  95.       TabIndex        =   1
  96.       Top             =   480
  97.       Width           =   852
  98.    End
  99.    Begin Label Label1 
  100.       Caption         =   "Your internetwork address:"
  101.       Height          =   252
  102.       Left            =   120
  103.       TabIndex        =   0
  104.       Top             =   120
  105.       Width           =   2412
  106.    End
  107. End
  108.  
  109. Sub Form_Load ()
  110.     Dim nodeAddr As NodeAddress
  111.     Static conns(MAX_CONNS) As Long
  112.     Static liT As DATE_AND_TIME
  113.  
  114.     connNum& = GetConnectionNumber()
  115.     ccode% = GetInternetAddress(connNum&, network&, nodeAddr, socket%)
  116.     If (ccode% <> SUCCESSFUL) Then
  117.         MsgBox "Unable to get connection number for connection " + Format$(connNum&), MB_OK, "Error"
  118.     Else
  119.         networkLabel.Caption = Hex$(LongSwap(network&))
  120.         nodeLabel.Caption = Hex$(LongSwap(nodeAddr.nodeHi)) + Hex$(IntSwap(nodeAddr.nodeLo))
  121.         socketLabel.Caption = Hex$(IntSwap(socket%))
  122.  
  123.         myName$ = String$(48, 0)
  124.         ccode% = GetConnectionInformation(connNum&, myName$, OT_USER, objectID&, liT)
  125.         If (ccode% <> SUCCESSFUL) Then
  126.             MsgBox "Unable to get connection information for connection " + Format$(connNum&), MB_OK, "Error"
  127.         Else
  128.             ccode% = GetObjectConnectionNumbers(myName$, OT_USER, numConns&, conns(0), MAX_CONNS)
  129.             If (ccode% <> SUCCESSFUL) Then
  130.                 MsgBox "Unable to get connection number for " + myName$, MB_OK, "Error"
  131.             Else
  132.                 For i% = 0 To (numConns& - 1)
  133.                     ccode% = GetConnectionInformation(conns(i%), myName$, OT_USER, objectID&, liT)
  134.                     If (ccode% <> SUCCESSFUL) Then
  135.                         MsgBox "Unable to get connection information for connection " + Format$(connNum&), MB_OK, "Error"
  136.                     Else
  137.                         temp$ = Str$(conns(i%)) + Space$(15)
  138.                         temp$ = temp$ + Format$(Asc(liT.hour), "00") + ":" + Format$(Asc(liT.minute), "00") + ":" + Format$(Asc(liT.second), "00") + "  "
  139.                         temp$ = temp$ + Format$(Asc(liT.month), "00") + "/" + Format$(Asc(liT.date), "00") + "/" + Format$(Asc(liT.year), "00")
  140.                         connList.AddItem temp$
  141.                     End If
  142.                 Next
  143.             End If
  144.         End If
  145.     End If
  146. End Sub
  147.  
  148. Sub OKButton_Click ()
  149.     Unload ConnForm
  150. End Sub
  151.  
  152.