Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check for Internet being UP.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01229275
Message ID:
01229322
Vues:
11
>>>Hi Gang!
>>>
>>>Do you have guys have any suggestions for code or utilities to use in VFP to check if the Internet is UP to a certain URL (able to connect to the site) and return this info to VFP?
>>>
>>>Thanks!
>>
>>Check Re: How to check the DSL Internet connectivity Thread #1072195
>>
>>You can also just try to instantiate IE and see the document response if you need to check for a specific site.
>
>Cetin had this code in the thread...
>
>*********************************************
>Declare integer InternetCheckConnection in wininet.dll ;
> string lpszUrl, integer dwFlags, integer dwReserved
>return ( InternetCheckConnection("http://www.microsoft.com",1,0) != 0) && use a fast&near host
>Cetin
>Çetin Basöz
>MS Foxpro MVP, MCP
>*********************************************
>
>Does anyone know if this works if you substitute the Internet Address for the URL???
>
>e.g.
>return ( InternetCheckConnection("http://208.237.158.79",1,0) != 0) && use a fast&near
>
>Thanks!

Yes, it does work. I re-tested.
CLEAR
#define FLAG_ICC_FORCE_CONNECTION 0x01

DECLARE INTEGER InternetCheckConnection IN wininet STRING lpszUrlSTRING, INTEGER dwFlags, INTEGER dwReserved
myFastLoadedSite = "http://www.levelextreme.com"
* google.com
myFastLoadedSite = [http://64.233.169.99]
? InternetCheckConnection(myFastLoadedSite,FLAG_ICC_FORCE_CONNECTION,0)

myFastLoadedSite = "http://www.universalthread_error.com"
? InternetCheckConnection(myFastLoadedSite,FLAG_ICC_FORCE_CONNECTION,0)

lcHostName = "www.google.com"    

  lcCommand = "%comspec% /c ping " + lcHostName + " -n 1 > ping.log"      
  loWshShell = CREATEOBJECT("WScript.Shell")        
  loWshShell.RUN(lcCommand, 0, .T.)         

  lcPing = filetostr("ping.log")

** To view the result
  _cliptext = m.lcPing
  =MESSAGEBOX(m.lcPing)
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform