使用以下代码,在this post的帮助下,我正在检查用户是否有可用的Internet连接:
Private Declare Function InternetGetConnectedState _
Lib "wininet.dll" (ByRef dwflags As Long, _
ByVal dwReserved As Long) As Long
Private Const INTERNET_CONNECTION_MODEM As Long = &H1
Private Const INTERNET_CONNECTION_LAN As Long = &H2
Private Const INTERNET_CONNECTION_PROXY As Long = &H4
Private Const INTERNET_CONNECTION_OFFLINE As Long = &H20
Function IsInternetConnected() As Boolean
Dim L As Long
Dim R As Long
R = InternetGetConnectedState(L, 0&)
If R = 0 Then
IsInternetConnected = False
Else
If R <= 4 Then
IsInternetConnected = True
Else
IsInternetConnected = False
End If
End If
End Function
这会返回以下错误,这似乎与64位系统有关:
如何以可靠的方式将此代码调整到32-64系统?
也许检查用户系统和google.com的回复?
答案 0 :(得分:0)
将mc
添加到Win 64位的声明中:
PtrSafe