VERSION 5.00 Begin VB.Form Form1 Caption = "Form1" ClientHeight = 3195 ClientLeft = 60 ClientTop = 345 ClientWidth = 4680 LinkTopic = "Form1" ScaleHeight = 3195 ScaleWidth = 4680 StartUpPosition = 3 'Windows Default Begin VB.TextBox Text1 Height = 2175 Left = 360 MultiLine = -1 'True TabIndex = 1 Top = 960 Width = 4215 End Begin VB.CommandButton Command1 Caption = "NBTSTAT" Height = 495 Left = 3120 TabIndex = 0 Top = 240 Width = 1215 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Private Sub Command1_Click() Dim NCB As NET_CONTROL_BLOCK Dim Lana As LANA_ENUM Dim AST As ASTAT Dim result As Integer Dim i As Integer Dim j As Integer Dim k As Integer Dim x As Integer Dim tTyp As String Dim tMac As String Dim tName As String Dim tFlag As Integer Dim tFlag_Name As String Dim tFlag_Name1 As String Dim Zone As String NCB.ncb_buffer = VarPtr(Lana) NCB.ncb_length = Len(Lana) NCB.ncb_command = NCBENUM result = Netbios(NCB) Debug.Print "result = "; result For i = 0 To Lana.Length - 1 'NCB.ncb_command = NCBRESET 'result = Netbios(NCB) 'If result <> 0 Then ' MsgBox "Reset Result = " & Str$(result) ' Exit Sub 'End If NCB.ncb_command = NCBASTAT NCB.ncb_buffer = VarPtr(AST) NCB.ncb_length = Len(AST) NCB.ncb_callname = "* " NCB.ncb_lana_num = Lana.Lana(i) result = Netbios(NCB) If result = 0 Then Zone = Zone & " NetBIOS Machine Name Table" & vbCrLf & vbCrLf Zone = Zone & "Name" & vbTab & vbTab & "Type" & vbTab & vbTab & "Status" & vbCrLf Zone = Zone & "---------------------------------------------------------------------------------" & vbCrLf tMac = "" For x = 0 To 5 tMac = tMac & Format$(Hex$(AST.adapt.adapter_address(x)), "00") & "." Next x For j = 0 To AST.adapt.name_count - 1 tName = "" For x = 0 To 14 tName = tName & Chr$(AST.NameBuff(j).name1(x)) Next x Debug.Print "Name" & x & " = " & tName tTyp = Format$(AST.NameBuff(j).name1(15), "00") tFlag = htons(AST.NameBuff(j).name_flags) If Int((tFlag / 256) And &H80) = &H80 Then tFlag_Name = " GROUP" Else tFlag_Name = " UNIQUE" End If If Int((tFlag / 256) And &H10) = &H10 Then tFlag_Name1 = "DeRegistering" If Int((tFlag / 256) And &H8) = &H8 Then tFlag_Name1 = "Name Conflict" If Int((tFlag / 256) And &H4) = &H4 Then tFlag_Name1 = "Registered" If Int((tFlag / 256) And &H2) = &H2 Then tFlag_Name1 = "Permanent Name" Zone = Zone & tName & vbTab & "<" & tTyp & ">" & tFlag_Name & vbTab & tFlag_Name1 & vbCrLf Next j Zone = Zone & vbCrLf & "MAC Address = " & Left$(tMac, 17) & vbCrLf & vbCrLf Else MsgBox "Error # : " & result End If Next i Text1 = Zone End Sub