Tjenna! när det gäller LAN kan du ju prova att pinga eller connecta mot en ip du vet är uppe tex www.pellesoft.nu eller aftonbladet.se Klistra in detta i en modul:Uppkopplad
Jag vet att det finns en "tutorial" här på pellesoft som kollar om man är uppkopplad mit internet. Problemet med denna är bara det att den inte har stöd för LAN. Är jag uppkopplad via LAN så tror den ändå att jag inte är uppkopplad. Är det någon som vet ett bättre sätt som STÖDJER LAN?
Tack*1000Sv: Uppkopplad
Sv: Uppkopplad
Option Explicit
Public Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpdwFlags As Long, ByVal dwReserved As Long) As Long
'Local system uses a modem to connect to the Internet.
Private Const INTERNET_CONNECTION_MODEM As Long = &H1
'Local system uses a LAN to connect to the Internet.
Private Const INTERNET_CONNECTION_LAN As Long = &H2
'Local system uses a proxy server to connect to the Internet.
Private Const INTERNET_CONNECTION_PROXY As Long = &H4
'No longer used.
Private Const INTERNET_CONNECTION_MODEM_BUSY As Long = &H8
Private Const INTERNET_RAS_INSTALLED As Long = &H10
Private Const INTERNET_CONNECTION_OFFLINE As Long = &H20
Private Const INTERNET_CONNECTION_CONFIGURED As Long = &H40
'InternetGetConnectedState wrapper functions
Public Function IsNetConnectViaLAN() As Boolean
Dim dwflags As Long
Call InternetGetConnectedState(dwflags, 0&)
IsNetConnectViaLAN = dwflags And INTERNET_CONNECTION_LAN
End Function
Public Function IsNetConnectViaModem() As Boolean
Dim dwflags As Long
Call InternetGetConnectedState(dwflags, 0&)
IsNetConnectViaModem = dwflags And INTERNET_CONNECTION_MODEM
End Function
Public Function IsNetConnectViaProxy() As Boolean
Dim dwflags As Long
Call InternetGetConnectedState(dwflags, 0&)
IsNetConnectViaProxy = dwflags And INTERNET_CONNECTION_PROXY
End Function
Public Function IsNetConnectOnline() As Boolean
IsNetConnectOnline = InternetGetConnectedState(0&, 0&)
End Function
Public Function IsNetRASInstalled() As Boolean
Dim dwflags As Long
Call InternetGetConnectedState(dwflags, 0&)
IsNetRASInstalled = dwflags And INTERNET_RAS_INSTALLED
End Function
Public Function GetNetConnectString() As String
Dim dwflags As Long
Dim msg As String
'build a string for display
If InternetGetConnectedState(dwflags, 0&) Then
If dwflags And INTERNET_CONNECTION_CONFIGURED Then
msg = msg & "You have a network connection configured." & vbCrLf
End If
If dwflags And INTERNET_CONNECTION_LAN Then
msg = msg & "The local system connects to the Internet via a LAN"
End If
If dwflags And INTERNET_CONNECTION_PROXY Then
msg = msg & ", and uses a proxy server. "
Else
msg = msg & "."
End If
If dwflags And INTERNET_CONNECTION_MODEM Then
msg = msg & "The local system uses a modem to connect to the Internet. "
End If
If dwflags And INTERNET_CONNECTION_OFFLINE Then
msg = msg & "The connection is currently offline. "
End If
If dwflags And INTERNET_CONNECTION_MODEM_BUSY Then
msg = msg & "The local system's modem is busy with a non-Internet connection. "
End If
If dwflags And INTERNET_RAS_INSTALLED Then
msg = msg & "Remote Access Services are installed on this system."
End If
Else
msg = "Not connected to the internet now."
End If
GetNetConnectString = msg
End Function
För att kolla om du är uppkopplad mot Internet, oavsett metod, anropar du med:
MsgBox IsNetConnectOnline