Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Online or Not...
Message
From
30/10/1999 15:34:05
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00281401
Message ID:
00284382
Views:
17
>Hi Eric,
>
>>Which API will tell me if I am connected to the Inet or not and of not call up the Win Dialer and connect without prompting?
>
>Declare Integer InternetGetConnectedState in WinINet.Dll Long @lpdwFlags, Long dwReserved
>lnFlags = 0
>? InternetGetConnectedState(@lnFlags,0)
>This function returns 0, if not connected, any other value if connected. The flags can be used to determine additional information, like connected via modem, LAN, Proxy, etc.
>
>Christof


Christof- this function doesn't work correctly, and never has. It is not dependable in a LAN or a dial-up situation. Believe me, I battled with it for a long time before having my suspicions confirmed by others (Rick Strahl one of them).

Eric-
I have discovered a useful alternative function to be much more reliable:

DECLARE INTEGER InternetAttemptConnect IN Wininet.dll INTEGER
=InternetAttemptConnect(0)

This is a modal function that will check to see if the computer is connected, and if not, initiate the default dialup connection, and wait for the connection to complete or fail. If the machine is already connected, it just immediately returns 0.

It does NOT give you a handle on the session though, which you will need if you want to programmatically disconnect after you are finished.
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform