Check online network availability

  • Thread starter Thread starter Hughes
  • Start date Start date
H

Hughes

Hi Friends

I want to establish, if the user is on-line with the network
fileserver. Scroll drives or using FileExist method (File Scripting
object) wont do the trick, because the path will often, but not always,
be available offline. I've got to know if they are connected - any
idea's?
Thanks/Mike
 
Try:

Private Declare Function IsNetworkAlive Lib "SENSAPI.DLL" (ByRef lpdwFlags
As Long) As Long

Sub xx()
Select Case IsNetworkAlive(0)
Case 0
MsgBox "not connected"
Case 1
MsgBox "connected to LAN"
Case 2
MsgBox "connected to WAN"
Case Else
MsgBox "connected to ?other network?"
endselect
End Sub

You probably want to verify whether IsNetWorkAlive returns 0 or nonzero only.
 
Very Cool. Thanks. I have no need for it right now, but it should come in
handy at some point in my life...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top