vfp9 check if interent is on

Hi Experts

I would like to check if internet is connected before I run a routine.

Who is Participating?
peterhuppConnect With a Mentor Commented:
Function ServerIsAvailable(tcUrlToCheck)
Local llReturn
m.llReturn = .T.
If !Directory(tcUrlToCheck) && First check if it is a directory path, if not then assume it is an URL
   Declare Integer InternetCheckConnection In wininet;
      STRING lpszUrl,;
      INTEGER dwFlags,;
      INTEGER dwReserved
   If InternetCheckConnection(m.tcUrlToCheck, 1, 0) != 1
      m.llReturn = .F.
Return m.llReturn

* source of this code is:
Olaf DoschkeSoftware DeveloperCommented:
There's also InternetGetConnectedState(), which doesn't need a test URL. On the other side you will know what URL you want to navigate, so InternetCheckConnection() would do the trick. I`m not sure if it will give false positives for finding cached results from a URL in your browser cache or proxy for example.

Bye, Olaf.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.