View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Network Computer Offline

The library "SENSAPI.DLL" is in the windows/system32 folder on your PC and
you cannot change the defination of the library. The function
IsDestinationReachable is in this library and the parameter can't be
modified. Copy the code below exactly as posted.

The library needs to know the lenght of the record returned so you need to
include this line: Ret.dwSize = Len(Ret)

Const NETWORK_ALIVE_AOL = &H4
Const NETWORK_ALIVE_LAN = &H1
Const NETWORK_ALIVE_WAN = &H2
Private Type QOCINFO
dwSize As Long
dwFlags As Long
dwInSpeed As Long 'in bytes/second
dwOutSpeed As Long 'in bytes/second
End Type
Private Declare Function IsDestinationReachable Lib "SENSAPI.DLL" _
Alias "IsDestinationReachableA" _
(ByVal lpszDestination As String, ByRef lpQOCInfo As QOCINFO) As Long
Private Sub Form_Load()
Dim Ret As QOCINFO
Ret.dwSize = Len(Ret)
If IsDestinationReachable("//HPNC6220", Ret) = 0 Then
MsgBox "The destination cannot be reached!"
Else
MsgBox "The destination can be reached!"
End If
End Sub



"Philosophaie" wrote:

This is what I have thus far:

Private Declare Function IsDestinationReachable Lib "//HPNC6220"
Sub Button1_Click()
If IsDestinationReachable(//HPNC6220, Ret) = 0 Then
MsgBox "The destination cannot be reached!"
Else
MsgBox "The destination can be reached!"
End If
End Sub

I want to ping the network computer \\HPNC6220 then use
IsDestinationReachable Lib to sort with an if-then to sort the results.