'网络(因特网)是否是连通的。Public Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As LongPublic 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 LongPublic Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As LongPublic Function ActiveConnection() As BooleanDim hKey As LongDim lpSubKey As StringDim phkResult As LongDim lpValueName As StringDim lpReserved As LongDim lpType As LongDim lpData As LongDim lpcbData As LongActiveConnection = FalselpSubKey = "SystemCurrentControlSetServicesRemoteAccess"ReturnCode = RegOpenKey(HKEY_LOCAL_MACHINE, lpSubKey, phkResult)If ReturnCode = ERROR_SUCCESS ThenhKey = phkResultlpValueName = "Remote Connection"lpReserved = APINULLlpType = APINULLlpData = APINULLlpcbData = APINULLReturnCode = RegQueryValueEx(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData)lpcbData = Len(lpData)ReturnCode = ReturnCode = RegQueryValueEx(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData)If ReturnCode = ERROR_SUCCESS ThenIf lpData = 0 ThenActiveConnection = FalseElseActiveConnection = TrueEnd IfEnd IfRegCloseKey (hKey)End IfEnd Function
'网络(因特网)是否是连通的。Public Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As LongPublic 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 LongPublic Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As LongPublic Function ActiveConnection() As BooleanDim hKey As LongDim lpSubKey As StringDim phkResult As LongDim lpValueName As StringDim lpReserved As LongDim lpType As LongDim lpData As LongDim lpcbData As LongActiveConnection = FalselpSubKey = "SystemCurrentControlSetServicesRemoteAccess"ReturnCode = RegOpenKey(HKEY_LOCAL_MACHINE, lpSubKey, phkResult)If ReturnCode = ERROR_SUCCESS ThenhKey = phkResultlpValueName = "Remote Connection"lpReserved = APINULLlpType = APINULLlpData = APINULLlpcbData = APINULLReturnCode = RegQueryValueEx(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData)lpcbData = Len(lpData)ReturnCode = ReturnCode = RegQueryValueEx(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData)If ReturnCode = ERROR_SUCCESS ThenIf lpData = 0 ThenActiveConnection = FalseElseActiveConnection = TrueEnd IfEnd IfRegCloseKey (hKey)End IfEnd Function
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货