vfp9  check if interent is on

Posted on 2012-08-31
Last Modified: 2012-09-01
Hi Experts

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

Question by:b001
    LVL 3

    Accepted Solution

    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:
    LVL 29

    Expert Comment

    by:Olaf Doschke
    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: (http://msd…
    Digital marketing agencies have encountered both the opportunities and difficulties that emerge from working with a wide-ranging organizations.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now