2010-05-20 43 views
0

不是VB6專家...試圖想出調用InternetCheckConnection的VB6測試應用程序。在我的測試應用程序中,無論使用哪個URL,InternetCheckConnection都會返回false。我從一個較大的意大利麪代碼應用複製並粘貼了這段代碼,但在意大利麪代碼中,InternetCheckConnection似乎正常工作,返回true。VB6中的InternetCheckConnection返回false

爲了使InternetCheckConnection正常工作,是否還有其他一些函數需要先調用?

+0

讓我們鏈接到[InternetGetConnection]的MSDN主題(http://msdn.microsoft.com/en-us/library/windows/desktop/aa384346(v = vs.85).aspx)。鏈接使互聯網更好:) – MarkJ 2012-08-21 20:23:12

回答

0

也許,在「spaghetti-code」應用程序中,InternetCheckConnection依賴於您不知道的某個全局變量的狀態。那可能嗎?

1

嘗試使用InternetGetConnectedState函數。

私人聲明函數的InternetGetConnectedState庫 「的wininet.dll」(爲ByRef lpSFlags只要,BYVAL dwReserved只要),只要

昏暗blnInternetConnected布爾 昏暗標誌只要

blnInternetConnected =的InternetGetConnectedState(旗, 0 &)

0

我能夠通過包括網站的完整地址(包括「http://」)來使InternetCheckConnection正常工作。例如,使用「www.google.com」返回False,但「http://www.google.com」返回true。