hallo!
nur eine kurze frage: mit welchen funktionen (api oder vb ist egal) kann ich feststellen, ob eine verbindung mit dem internet besteht bzw. darauf reagieren das diese getrennt wird?
thx schonmal,
markus
hallo!
nur eine kurze frage: mit welchen funktionen (api oder vb ist egal) kann ich feststellen, ob eine verbindung mit dem internet besteht bzw. darauf reagieren das diese getrennt wird?
thx schonmal,
markus
Morgen,
ich könnte dir nur den Code geben mit dem auf eine aktive Internetverbindung überprüfen kannst.
Ich hoffe du kannst damit was anfangen:
'in modul:
Public Const ERROR\_SUCCESS = 0&
Public Const APINULL = 0&
Public Const HKEY\_LOCAL\_MACHINE = &H80000002
Public ReturnCode As Long
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey \_
As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" \_
(ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, \_
lpType As Long, lpData As Any, lpcbData As Long) As Long
'in die form:
Public Function ActiveConnection() As Boolean
Dim hKey As Long
Dim lpSubKey As String
Dim phkResult As Long
Dim lpValueName As String
Dim lpReserved As Long
Dim lpType As Long
Dim lpData As Long
Dim lpcbData As Long
ActiveConnection = False
lpSubKey = "System\CurrentControlSet\Services\RemoteAccess"
ReturnCode = RegOpenKey(HKEY\_LOCAL\_MACHINE, lpSubKey, phkResult)
If ReturnCode = ERROR\_SUCCESS Then
hKey = phkResult
lpValueName = "Remote Connection"
lpReserved = APINULL
lpType = APINULL
lpData = APINULL
lpcbData = APINULL
ReturnCode = RegQueryValueEx(hKey, lpValueName, \_
lpReserved, lpType, ByVal lpData, lpcbData)
lpcbData = Len(lpData)
ReturnCode = RegQueryValueEx(hKey, lpValueName, \_
lpReserved, lpType, lpData, lpcbData)
If ReturnCode = ERROR\_SUCCESS Then
If lpData = 0 Then
ActiveConnection = False
Else
ActiveConnection = True
End If
End If
RegCloseKey (hKey)
End If
End Function
Private Sub Form\_Load()
If ActiveConnection = True Then
Call MsgBox("You Connected to the internet")
Else
Call MsgBox("You Not Connected to the internet")
End If
End Sub
[Bei dieser Antwort wurde das Vollzitat nachträglich automatisiert entfernt]
thx, ziemlich genau was ich brauchte! den rest kann ich mir selbst zusammenbasteln.
markus