Dear Reader,
In this blog you will get source code for check internet connection in visual foxpro.
https://docs.microsoft.com/en-us/windows/win32/wininet/about-wininet
https://docs.microsoft.com/en-us/windows/win32/api/wininet/nf-wininet-internetcheckconnectiona#syntax
Testing2.prg -- This method is more reliable for check internet connection in VFP - Visual foxpro
DECLARE INTEGER InternetCheckConnection in wininet;
STRING lpszUrl,;
INTEGER dwFlags,;
INTEGER dwReserved
IF InternetCheckConnection("http://www.google.com/", 1, 0) = 1
WAIT WINDOW 'There is an internet connection'
ELSE
WAIT WINDOW 'There is no internet connection'
ENDIF
abc= InternetCheckConnection("http://www.google2222.com/",11,0)
WAIT WINDOW abc
Testing.prg -- Less Reliable code
DECLARE INTEGER InternetAttemptConnect IN wininet;
INTEGER dwReserved
IF InternetAttemptConnect(0) = 0
WAIT WINDOW 'There is an internet connection' NOWAIT
ELSE
WAIT WINDOW 'There is no internet connection' NOWAIT
ENDIF