Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detecting an Internet Connection
Message
De
10/01/2002 12:26:32
 
 
À
10/01/2002 04:54:28
Alexandre Palma
Harms Software, Inc.
Alverca, Portugal
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Divers
Thread ID:
00602563
Message ID:
00603061
Vues:
27
Wow! This is great!
Thank you very much.
Winn

>Winn the return value is a combinnation of values in your case means that that you are connectin over a lan you have a proxy you have ras installed and the connection is configured.
>see the following example uou can copy this code put on a prg an run it.
>
>#DEFINE INTERNET_CONNECTION_MODEM        1
>#DEFINE INTERNET_CONNECTION_LAN          2
>#DEFINE INTERNET_CONNECTION_PROXY        4
>#DEFINE INTERNET_CONNECTION_MODEM_BUSY   8
>#DEFINE INTERNET_RAS_INSTALLED          16
>#DEFINE INTERNET_CONNECTION_OFFLINE     32
>#DEFINE INTERNET_CONNECTION_CONFIGURED  64
>
>    DECLARE SHORT InternetGetConnectedState IN wininet.dll;
>        INTEGER @lpdwFlags, INTEGER dwReserved
>
>    DECLARE SHORT InternetGetConnectedStateEx IN wininet.dll;
>        INTEGER @lpdwFlags, STRING @lpszConnectionName,;
>        INTEGER dwNameLen, INTEGER dwReserved
>
>    DO displayState
>    DO displayStateEx
>RETURN
>
>PROCEDURE  displayState
>    ? "*** InternetGetConnectedState:"
>    lpdwFlags = 0
>    IF InternetGetConnectedState (@lpdwFlags, 0) = 1
>        ? "  Flags returned:       " +;
>            LTRIM(STR(lpdwFlags))
>
>        ? "  Modem connection:     " +;
>            _ok(lpdwFlags, INTERNET_CONNECTION_MODEM)
>
>        ? "  LAN connection:       " +;
>            _ok(lpdwFlags, INTERNET_CONNECTION_LAN)
>
>        ? "  Proxy connection:     " +;
>            _ok(lpdwFlags, INTERNET_CONNECTION_PROXY)
>
>        ? "  The modem is busy:    " +;
>            _ok(lpdwFlags, INTERNET_CONNECTION_MODEM_BUSY)
>
>        ? "  The RAS is installed: " +;
>            _ok(lpdwFlags, INTERNET_RAS_INSTALLED)
>
>        ? "  Offline connection:   " +;
>            _ok(lpdwFlags, INTERNET_CONNECTION_OFFLINE)
>
>        ? "  Is configured:        " +;
>            _ok(lpdwFlags, INTERNET_CONNECTION_CONFIGURED)
>    ELSE
>        ? "InternetGetConnectedState error"
>    ENDIF
>RETURN
>
>PROCEDURE  displayStateEx
>* the same as the regular one except the connection name is returned
>    ?
>    ? "*** InternetGetConnectedStateEx:"
>    lpdwFlags = 0
>    lcConnection = REPLI (Chr(0), 250)
>    IF InternetGetConnectedStateEx (@lpdwFlags,;
>        @lcConnection, Len(lcConnection), 0) = 1
>
>        ? "  Flags returned:       " + LTRIM(STR(lpdwFlags))
>        ? "  Connection name: " +;
>            SUBSTR (lcConnection, 1, AT(Chr(0), lcConnection)-1)
>    ELSE
>        ? "InternetGetConnectedStateEx error"
>    ENDIF
>RETURN
>
>FUNCTION  _ok (lnBase, lnValue)
>RETURN  Iif(BitAnd(lnBase, lnValue)=lnValue, "Yes","No")
>
>
>>Alexandre,
>> Cool code, but what does a return of '86' mean? Is there a list somewhere?
>>Thanks,
Winn Pauley
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform