Private Function InternetConnected(Optional ByRef eConnectionInfo _ As EIGCInternetConnectionState, Optional ByRef _ sConnectionName As String) As Boolean '判断是否连接到internet子程序
Dim dwFlags As Long Dim sNameBuf As String Dim lR As Long Dim iPos As Long
sNameBuf = String$(513, 0) lR = InternetGetConnectedStateEx(dwFlags, sNameBuf, 512, 0&) eConnectionInfo = dwFlags iPos = InStr(sNameBuf, vbNullChar) If iPos > 0 Then sConnectionName = Left$(sNameBuf, iPos - 1) ElseIf Not sNameBuf = String$(513, 0) Then sConnectionName = sNameBuf End If InternetConnected = (lR = 1) End Function
As EIGCInternetConnectionState, Optional ByRef _
sConnectionName As String) As Boolean '判断是否连接到internet子程序
Dim dwFlags As Long
Dim sNameBuf As String
Dim lR As Long
Dim iPos As Long
sNameBuf = String$(513, 0)
lR = InternetGetConnectedStateEx(dwFlags, sNameBuf, 512, 0&)
eConnectionInfo = dwFlags
iPos = InStr(sNameBuf, vbNullChar)
If iPos > 0 Then
sConnectionName = Left$(sNameBuf, iPos - 1)
ElseIf Not sNameBuf = String$(513, 0) Then
sConnectionName = sNameBuf
End If
InternetConnected = (lR = 1)
End Function