Ping function in VB6 
Author Message
 Ping function in VB6

hi.

I need a internet ping function for Visual Basic 6.
i need to give it an IP addresss and it return the ping of the site in (ms)
like the Windows95/98 ping.exe

thanks



Wed, 17 Jul 2002 03:00:00 GMT  
 Ping function in VB6
Take a look at this

http://www.mvps.org/vbnet/code/network/ping.htm

regards

Ian

** invalid email address, change dk to denmark

homepage http://www.kingsoft-denmark.com/


Quote:
> hi.

> I need a internet ping function for Visual Basic 6.
> i need to give it an IP addresss and it return the ping of the site in
(ms)
> like the Windows95/98 ping.exe

> thanks



Wed, 17 Jul 2002 03:00:00 GMT  
 Ping function in VB6

Quote:

>hi.

>I need a internet ping function for Visual Basic 6.
>i need to give it an IP addresss and it return the ping of the site in (ms)
>like the Windows95/98 ping.exe

>thanks

Can these help?

VBNet http://www.mvps.org/vbnet/code/network/ping.htm
How to Ping an IP Address Using Visual Basic. VB4-32, VB5, VB6.

Visual Basic on line magazine.
http://home.earthlink.net/~butlerbob/vb/network/tcpip/ping.htm
Performing a 'Ping' from Visual Basic. Code and Explanation.

Henri Leboeuf
Web page: http://www.generation.net/~hleboeuf/index.htm



Wed, 17 Jul 2002 03:00:00 GMT  
 Ping function in VB6
Here is a function (kludge) that should work for you (unless you are using
WinNT with very high security in place) until someone post a "proper"
solution. Just paste it into the (General)(Declarations) section of your
form (or remove the Private keywords and place it in a BAS module if you
need global scope).

Private Declare Function OpenProcess _
        Lib "kernel32" _
        (ByVal dwDesiredAccess As Long, _
         ByVal bInheritHandle As Long, _
         ByVal dwProcessId As Long) As Long
Private Declare Function CloseHandle _
        Lib "kernel32" _
        (ByVal hObject As Long) As Long
Private Declare Function WaitForSingleObject _
        Lib "kernel32" _
        (ByVal hHandle As Long, _
         ByVal dwMilliseconds As Long) As Long

Function GetPingInfo(URLName As String) As String

  Dim PID As Long
  Dim hProcess As Long
  Dim DirLine As String

  GetPingInfo = ""
  tempfile = App.Path
  If Right$(tempfile, 1) <> "\" Then tempfile = tempfile & "\"
  tempfile = tempfile & "ping.info"
  PID = Shell(Environ("comspec") & " /c ping """ & URLName & _
                                   """ > """ & tempfile & """", vbHide)
  If PID = 0 Then
     '
     'Handle Error, The Shell call failed completely
     '
  Else
     hProcess = OpenProcess(&H100000, True, PID)
     WaitForSingleObject hProcess, -1
     CloseHandle hProcess
  End If

  FileNumber = FreeFile
  Open tempfile For Input As #FileNumber
  GetPingInfo = Input(LOF(FileNumber), FileNumber)
  Close #FileNumber
  Kill tempfile

End Function

If you want to show all of the ping info returned, you can assign it to,
say, a TextBox using Text1.Text = GetPingInf("www.microsoft.com") for
example. If you only want a part of the returned info, assign it to a string
variable and parse it as necessary using InStr, Mid$, Left$, Right$, etc.

Rick


Quote:
> hi.

> I need a internet ping function for Visual Basic 6.
> i need to give it an IP addresss and it return the ping of the site in
(ms)
> like the Windows95/98 ping.exe

> thanks



Wed, 17 Jul 2002 03:00:00 GMT  
 Ping function in VB6


Quote:
> Here is a function (kludge) that should work for you (unless you are using
> WinNT with very high security in place) until someone post a "proper"
> solution. Just paste it into the (General)(Declarations) section of your
> form (or remove the Private keywords and place it in a BAS module if you
> need global scope).
>   PID = Shell(Environ("comspec") & " /c ping """ & URLName & _

Thanks, but this is not good for me, b`cos you are using external program
("ping.exe") I need an internal function.
when I use shell() it slow my app.

--



Thu, 18 Jul 2002 03:00:00 GMT  
 Ping function in VB6
Did you look for a ocx yet???
just a suggestion, im going to be doing the same thing in a few weeks here, and
thats what i plan on doing

"The illiterate of the 21st century will not be those who cannot read and
write, but those who cannot learn, unlearn and relearn."--Alvin Toffer



Fri, 19 Jul 2002 03:00:00 GMT  
 Ping function in VB6


Quote:
>hi.

>I need a internet ping function for Visual Basic 6.
>i need to give it an IP addresss and it return the ping of the site in (ms)
>like the Windows95/98 ping.exe

You can easily do this with our ICMP control, which is part of our
SocketTools Visual Edition. Take a look at the included Ping example
to see what you want to do. You can download SocketTools from our web
site at www.catalyst.com

David



Sat, 20 Jul 2002 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. how can i create ping function

2. Shell function and ping

3. Bug in ICMPSendEcho function under Win95? (Ping)

4. PING, Is there an API (or other method) to call ping from VB

5. Ping writing ping component voor asp

6. API for PING in vb6

7. Using Ping in VB6.0 ?

8. Pinging another host in VB6

9. Using Ping in VB6.0 ?

10. Using Ping in VB6.0 ?

11. VB6 Ping

12. Using Ping in VB6.0 ?

 

 
Powered by phpBB® Forum Software