VB6中的InternetCheckConnection返回false

问题描述 投票:1回答:3

我正在尝试提出一个调用InternetCheckConnection的VB6测试应用程序。

在我的测试应用中,无论我使用的URL是什么,InternetCheckConnection总是返回false。我从一个较大的意大利面条代码应用程序复制并粘贴了此代码,但是在意大利面条代码中,InternetCheckConnection似乎可以正常工作,返回true。

为了让InternetCheckConnection正常工作,我是否必须先调用其他功能?

vb6
3个回答
1
投票

通过包含网站的完整地址(包括“ http://”,我能够使InternetCheckConnection正常工作。例如,使用“ www.google.com”返回False,但是“ http://www.google.com”返回true。


1
投票

尝试使用InternetGetConnectedState函数。

Private Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpSFlags As Long, ByVal dwReserved As Long) As Long

Dim blnInternetConnected as Boolean
Dim Flags as long

blnInternetConnected = InternetGetConnectedState(Flags, 0&)

0
投票

也许,在“意大利面条代码”应用程序中,InternetCheckConnection依赖于您不知道的某些全局变量的状态。有可能吗?

© www.soinside.com 2019 - 2024. All rights reserved.