This is one of the most reliable ways to do this. Some other methods can provide erroneous results if the user's machine is hooked up to a network. You can replace the IP I have used with one of your own, especially if the reason you are checking the connection is to see if the user can get to your FTP site of Website you should use that IP instead, because sometimes you not only want to know if the user has an internet connection but also can they get to your site.
DECLARE INTEGER GetRTTAndHopCount IN Iphlpapi; INTEGER DestIpAddress, LONG @HopCount,; INTEGER MaxHops, LONG @RTT
DECLARE INTEGER inet_addr IN ws2_32 STRING cp
LOCAL lnDst, lnHop, lnRTT lnDst = inet_addr("220.127.116.11") && Yahoo IP, replace with your own IP address if you don't want reliance on yahoo STORE 0 TO lnHop, lnRTT
IF GetRTTAndHopCount(lnDst, @lnHop, 50, @lnRTT) = 0 MESSAGEBOX("You are not currently connected to the internet.") ELSE MESSAGEBOX("You are connected to the internet.") ENDIF CLEAR DLLS GetRTTAndHopCount, inet_addr