home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{DAA0D7B7-6667-11D1-9A13-00C04FD8DC2E}#1.0#0"; "DPing.dll"
- Begin VB.Form Form1
- BackColor = &H00C0C0C0&
- Caption = "DameWare Ping Sample"
- ClientHeight = 4980
- ClientLeft = 930
- ClientTop = 1050
- ClientWidth = 8040
- FillColor = &H00404040&
- FillStyle = 0 'Solid
- LinkTopic = "Form1"
- ScaleHeight = 4980
- ScaleWidth = 8040
- StartUpPosition = 2 'CenterScreen
- Begin VB.CheckBox Check3
- Caption = "Use Pre-Formatted"
- Height = 255
- Left = 3480
- TabIndex = 9
- Top = 1200
- Width = 2175
- End
- Begin VB.Timer Timer1
- Left = 6720
- Top = 240
- End
- Begin VB.CommandButton Command2
- Caption = "Stop"
- Enabled = 0 'False
- Height = 375
- Left = 6600
- TabIndex = 2
- Top = 2040
- Width = 1335
- End
- Begin VB.TextBox Text6
- Height = 375
- Left = 4080
- TabIndex = 0
- Text = "yahoo.com"
- Top = 2520
- Width = 2175
- End
- Begin VB.TextBox Text5
- Alignment = 1 'Right Justify
- Height = 375
- Left = 120
- TabIndex = 6
- Text = "60"
- Top = 2520
- Width = 735
- End
- Begin VB.TextBox Text4
- Alignment = 1 'Right Justify
- Height = 375
- Left = 120
- TabIndex = 5
- Text = "1000"
- Top = 1800
- Width = 735
- End
- Begin VB.TextBox Text3
- Alignment = 1 'Right Justify
- Height = 375
- Left = 120
- TabIndex = 4
- Text = "32"
- Top = 1080
- Width = 735
- End
- Begin VB.CheckBox Check2
- Caption = "Resolve addresses to hostnames."
- Height = 375
- Left = 3480
- TabIndex = 8
- Top = 720
- Width = 2175
- End
- Begin VB.CheckBox Check1
- Caption = "Ping the specifed host until interrupted."
- Height = 375
- Left = 3480
- TabIndex = 7
- Top = 240
- Width = 2295
- End
- Begin VB.TextBox Text2
- Alignment = 1 'Right Justify
- Height = 375
- Left = 120
- TabIndex = 3
- Text = "4"
- Top = 360
- Width = 735
- End
- Begin VB.TextBox Text1
- BeginProperty Font
- Name = "Courier"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1935
- Left = 120
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 11
- Top = 3000
- Width = 7815
- End
- Begin VB.CommandButton Command1
- Caption = "Ping"
- Default = -1 'True
- Height = 375
- Left = 6600
- TabIndex = 1
- Top = 2520
- Width = 1335
- End
- Begin DPINGLibCtl.DPingCtl DPingCtl1
- Height = 480
- Left = 7320
- TabIndex = 10
- TabStop = 0 'False
- Top = 240
- Width = 480
- PacketSize = 32
- TTL = 60
- Timeout = 1000
- Continues = 0
- PingCount = 3
- HostName = ""
- ResolveAddress = 0
- IPAddress = ""
- UseWindow = 0
- ScrollBar = 1
- End
- Begin VB.Shape Shape1
- FillColor = &H0000FF00&
- FillStyle = 0 'Solid
- Height = 375
- Left = 6960
- Shape = 3 'Circle
- Top = 1560
- Width = 615
- End
- Begin VB.Label Label5
- Caption = "IP Address or Host Name to Ping"
- Height = 255
- Left = 4080
- TabIndex = 16
- Top = 2280
- Width = 2415
- End
- Begin VB.Label Label4
- Caption = "Time To Live."
- Height = 255
- Left = 120
- TabIndex = 15
- Top = 2280
- Width = 1575
- End
- Begin VB.Label Label3
- Caption = "Timeout in milliseconds to wait for each reply."
- Height = 255
- Left = 120
- TabIndex = 14
- Top = 1560
- Width = 3255
- End
- Begin VB.Label Label2
- Caption = "Send buffer size."
- Height = 255
- Left = 120
- TabIndex = 13
- Top = 840
- Width = 1455
- End
- Begin VB.Label Label1
- Caption = "Number of echo requests to send"
- Height = 255
- Left = 120
- TabIndex = 12
- Top = 120
- Width = 2535
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Command1_Click()
- Text1.Text = ""
- Shape1.FillColor = &HFF&
- Command1.Enabled = False
- DPingCtl1.ResolveAddress = Check2.Value
- DPingCtl1.Continuous = Check1.Value
- DPingCtl1.PingCount = CLng(Text2.Text)
- DPingCtl1.PacketSize = CLng(Text3.Text)
- DPingCtl1.TTL = CLng(Text5.Text)
- DPingCtl1.Timeout = CLng(Text4.Text)
- DPingCtl1.Ping Text6.Text
- If Check3.Value = 0 Then
- If DPingCtl1.HostName = "" Then
- Text1.Text = "Pinging " + Text6.Text + " with " + Text3.Text + "bytes of data:" + Chr(13) + Chr(10) + Chr(13) + Chr(10)
- Else
- Text1.Text = "Pinging " + DPingCtl1.HostName + " [" + DPingCtl1.IPAddress + "] " + "with " + Text3.Text + "bytes of data:" + Chr(13) + Chr(10) + Chr(13) + Chr(10)
- End If
- End If
- Timer1.Interval = 100
- End Sub
- Private Sub Command2_Click()
- DPingCtl1.IsRunning = False
- End Sub
- Private Sub DPingCtl1_OnPing(ByVal strIpAddress As String, ByVal lBytes As Long, ByVal lTime As Long, ByVal lTTL As Long)
- If Check3.Value = 0 Then
- If lTime < 10 Then
- StrTime$ = " time<10"
- Else
- StrTime$ = " time=" + LTrim(Str(lTime))
- End If
- If lBytes = -1 Then
- Text1.Text = Text1.Text + "Request timed out." + Chr(13) + Chr(10)
- Else
- Text1.Text = Text1.Text + "Reply from " + strIpAddress + ": bytes=" + LTrim(Str(lBytes)) + StrTime$ + " TTL=" + LTrim(Str(lTTL)) + Chr(13) + Chr(10)
- End If
- Text1.SelStart = Len(Text1.Text)
- Text1.SelLength = 0
- End If
- End Sub
- Private Sub DPingCtl1_OnPingError(ByVal strError As String, ByVal lError As Long)
- Text1.Text = Text1.Text + strError
- Text1.SelStart = Len(Text1.Text)
- Text1.SelLength = 0
- End Sub
- Private Sub DPingCtl1_OnPingStr(ByVal strPing As String)
- If Check3.Value = 1 Then
- Text1.Text = Text1.Text + strPing
- Text1.SelStart = Len(Text1.Text)
- Text1.SelLength = 0
- End If
- End Sub
- Private Sub Timer1_Timer()
- If DPingCtl1.IsRunning Then
- Shape1.FillColor = &HFF&
- Command2.Enabled = True
- Shape1.FillColor = &HFF00&
- Command2.Enabled = False
- Command1.Enabled = True
- End If
- End Sub
-