home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
- Begin VB.Form NetStat
- AutoRedraw = -1 'True
- BorderStyle = 3 'Fixed Dialog
- Caption = "vbNetStat"
- ClientHeight = 3960
- ClientLeft = 45
- ClientTop = 405
- ClientWidth = 9375
- ClipControls = 0 'False
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 3960
- ScaleWidth = 9375
- StartUpPosition = 1 'CenterOwner
- Begin MSComctlLib.ListView NSview
- Height = 3360
- Left = 0
- TabIndex = 3
- Top = 360
- Width = 9375
- _ExtentX = 16536
- _ExtentY = 5927
- View = 3
- MultiSelect = -1 'True
- LabelWrap = -1 'True
- HideSelection = -1 'True
- FullRowSelect = -1 'True
- _Version = 393217
- ForeColor = -2147483640
- BackColor = -2147483643
- BorderStyle = 1
- Appearance = 1
- NumItems = 4
- BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
- Text = "Protocol"
- Object.Width = 1411
- EndProperty
- BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
- SubItemIndex = 1
- Text = "Local Address:port"
- Object.Width = 6174
- EndProperty
- BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
- SubItemIndex = 2
- Text = "Remote Address:port"
- Object.Width = 6174
- EndProperty
- BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
- SubItemIndex = 3
- Text = "State"
- Object.Width = 2469
- EndProperty
- End
- Begin MSComctlLib.Toolbar Toolbar1
- Align = 1 'Align Top
- Height = 360
- Left = 0
- TabIndex = 1
- Top = 0
- Width = 9375
- _ExtentX = 16536
- _ExtentY = 635
- ButtonWidth = 609
- ButtonHeight = 582
- AllowCustomize = 0 'False
- Wrappable = 0 'False
- Appearance = 1
- Style = 1
- ImageList = "Images"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 6
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Key = "Quit"
- Description = "Quit"
- Object.ToolTipText = "Quit"
- ImageIndex = 6
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Key = "Refresh"
- Description = "Refresh"
- Object.ToolTipText = "Refresh"
- ImageIndex = 9
- EndProperty
- BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Key = "Print"
- Description = "Print"
- Object.ToolTipText = "Print"
- ImageIndex = 7
- EndProperty
- BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Key = "Help"
- Description = "Help"
- Object.ToolTipText = "Help"
- ImageIndex = 4
- EndProperty
- EndProperty
- Begin VB.PictureBox Picture1
- Height = 0
- Left = 0
- ScaleHeight = 0
- ScaleWidth = 0
- TabIndex = 2
- Top = 0
- Width = 0
- End
- End
- Begin MSComctlLib.ImageList Images
- Left = 7920
- Top = 3120
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 9
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "Protect.frx":0000
- Key = "Proc"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "Protect.frx":059C
- Key = "Watch"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "Protect.frx":09F0
- Key = "Kill"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "Protect.frx":0E44
- Key = "Help"
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "Protect.frx":1598
- Key = "About"
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "Protect.frx":19EC
- Key = "Exit"
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "Protect.frx":1E40
- Key = "Print"
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "Protect.frx":1F54
- Key = "Reg"
- EndProperty
- BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "Protect.frx":20B0
- Key = "Refresh"
- EndProperty
- EndProperty
- End
- Begin MSComctlLib.StatusBar SBar
- Align = 2 'Align Bottom
- Height = 255
- Left = 0
- TabIndex = 0
- Top = 3705
- Width = 9375
- _ExtentX = 16536
- _ExtentY = 450
- _Version = 393216
- BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
- NumPanels = 3
- BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
- Alignment = 1
- Object.Width = 13053
- MinWidth = 13053
- EndProperty
- BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
- Style = 5
- Object.Width = 1587
- MinWidth = 1587
- TextSave = "11:23 PM"
- EndProperty
- BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
- Style = 6
- Alignment = 1
- Object.Width = 1940
- MinWidth = 1940
- TextSave = "10/07/1999"
- EndProperty
- EndProperty
- End
- Begin VB.Menu m_procoptions
- Caption = "Options"
- Visible = 0 'False
- Begin VB.Menu m_KillProc
- Caption = "Kill Process"
- End
- Begin VB.Menu sbar0
- Caption = "-"
- End
- Begin VB.Menu mProcinfo
- Caption = "Process Info"
- End
- End
- Begin VB.Menu m_regoptions
- Caption = "Options"
- Visible = 0 'False
- Begin VB.Menu m_RegRemove
- Caption = "Remove Entry"
- End
- End
- Attribute VB_Name = "NetStat"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub Form_Load()
- RefreshNS
- End Sub
- Private Sub RefreshNS()
- Dim Item As ListItem
- Dim ln As Integer, x As Integer
- Dim Fn As String, D1 As String
- Dim LStr As String
- Dim FileNum As Integer
- Dim FileLength As Long
- NSview.ListItems.Clear
- Fn = App.Path & "\netstat.txt"
- ShellAndWait "c:\command.com /c c:\windows\netstat.exe -a >" & Fn
- FileNum = FreeFile
- Open Fn For Input As FileNum ' Open file for input.
- FileLength = LOF(FileNum)
- If FileLength > 10 Then
- For ln = 1 To 4
- Input #FileNum, LStr ' Read data
- Next
- Do While Not EOF(FileNum) ' Loop until end of file.
- Input #FileNum, LStr ' Read data
- Set Item = NSview.ListItems.Add()
- Item.Text = GetNxtWord(LStr)
- For x = 1 To 3
- D1 = GetNxtWord(LStr)
- Item.SubItems(x) = D1
- Next
- Loop
- End If
- Close #FileNum ' Close file.
- End Sub
- Function GetNxtWord(ByRef S As String) As String
- Dim i As Integer, x As Integer, s1 As String, s2 As String
- s1 = S
- i = InStr(s1, " ")
- If (i > 1) Then
- s2 = Left(s1, i - 1)
- S = Right(s1, (Len(s1) - i))
- If Left(s2, 1) <> " " Then
- GetNxtWord = s2
- Exit Do
- End If
- ElseIf (i = 0) Then
- GetNxtWord = s1
- S = ""
- Exit Do
- Else
- S = Right(s1, (Len(s1) - i))
- End If
- Loop
- End Function
- Private Sub Form_Terminate()
- Unload Me
- End Sub
- Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
- Select Case Button.Key
- Case "Refresh"
- RefreshNS
- Case "Quit"
- Unload Me
- End Select
- End Sub
- Public Sub ShellAndWait(ByVal CommandLine As String)
- Dim ReturnValue As Long
- Dim Start As STARTUPINFO
- Dim Process As PROCESS_INFORMATION
- ' Initialize the STARTUPINFO structure:
- Start.cb = Len(Start)
- Start.dwFlags = STARTF_USESHOWWINDOW
- Start.wShowWindow = SW_HIDE
- ' Start the shelled application:
- ReturnValue = CreateProcessA(0&, CommandLine, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, Start, Process)
- ' Wait for the shelled application to finish
- ReturnValue = WaitForSingleObject(Process.hProcess, INFINITE)
- CloseHandle Process.hProcess
- End Sub
-