tags:

views:

59

answers:

2

Hi all, Not a VB6 expert... Trying to come up with a VB6 test app that calls InternetCheckConnection. In my test app, InternetCheckConnection always returns false regardless of the URL I use. I copied and pasted this code from a larger spaghetti-code app, but in the spaghetti-code, InternetCheckConnection seems to work fine, returns true.

Is there some other function I have to call first in order for InternetCheckConnection to work?

A: 

Perhaps, in the "spaghetti-code" app, InternetCheckConnection is relying on the state of some global variable you are not aware of. Is that possible?

Stuart Helwig
+1  A: 

Try using the InternetGetConnectedState function.

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&)

dretzlaff17