Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check for Internet Connection
Message
De
22/02/2011 21:15:23
 
 
À
20/02/2011 17:01:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP1
Divers
Thread ID:
01500982
Message ID:
01501365
Vues:
133
I got a partial answer to question #1 when I ran my app on a "Virgin" Vista Home Premium SP2... it choked when it couldn't find MSWinsock. I think I understand that I can sub-class the MSWinsock Ole... I've done that and created Winsock.Vcx Now my question is, do I call this ActiveX from a form that has the Vcx as an Olecontrol? I'm admittedly out of my league here and appreciate any help.

As to question 2... this code seems to execute fine, but again is there virus exposure by using Wscript.Shell?

Thanks,

dg




>Thanks for the link. I don't understand all I know about the referenced thread.... that's another way to say I'm not smart enough to see an answer to my questions on the 2 snippets I posted!
>dg
>
>>Check also this thread Re: Internet connection test revival Thread #1498390
>>
>>>My application checks for an internet connection. Users are not normally on a LAN, but have an individual ISP, dial-up, broadband or air-card.
>>>
>>>I've found these routines posted previously here.
>>>Example 1:
>>>
>>>Declare Integer InternetCheckConnection In wininet;
>>>	STRING lpszUrl, Integer dwFlags, Integer dwReserved
>>>#Define FLAG_ICC_FORCE_CONNECTION  1
>>>= _check ("http://www.microsoft.com")
>>>Procedure _check(lcUrl)
>>>gcConnectionStatus = (InternetCheckConnection(lcUrl, FLAG_ICC_FORCE_CONNECTION, 0)=1)
>>>oSocket = Createobject("MSWinsock.Winsock")
>>>
>>>Clear Dlls "InternetCheckConnection"
>>>
>>>If ! oSocket.LocalIP = "127.0.0.1"
>>>	gcIpAddress=oSocket.LocalIP
>>>	gcConnectionStatus = 'IP Address'
>>>Else
>>>	gcIpAddress=''
>>>	gcConnectionStatus = 'Not Connected'
>>>ENDIF
>>>
>>>
>>>Example 2:
>>>
>>>Local lcTempFile, loWSH  &&&, gcIPAddress
>>>lcTempFile="LocalIP.txt"
>>>If File(lcTempFile)		&&erase leftovers from old run
>>>	Erase (lcTempFile)
>>>Endif
>>>loWSH=Createobject("Wscript.Shell")
>>>loWSH.Run("command /c ipconfig > "+lcTempFile,0,1)
>>>If File(lcTempFile)		&&read the file and parse it
>>>	gcIpAddress=Upper(Filetostr(lcTempFile))
>>>	gcIpAddress=Substr(gcIpAddress, At('IP ADDRESS',gcIpAddress))
>>>	gcIpAddress=Substr(gcIpAddress, At(':',gcIpAddress)+2)
>>>	gcIpAddress=Substr(gcIpAddress, 1, At(Chr(13),gcIpAddress)-1)
>>>Endif
>>>If File(lcTempFile)		&&erase leftovers from old run
>>>	Erase (lcTempFile)
>>>Endif
>>>If Len(Alltrim(gcIpAddress)) = 0
>>>	gcConnectionStatus = 'Not Connected'
>>>Else
>>>	gcConnectionStatus = 'IP Address'
>>>Endif
>>>
>>>
>>>My questions are:
>>>Is Example # 1 subject to errors related to presence (or absence) of MSWinsock?
>>>Is Example # 2 particularly vulnerable to viruses?
>>>
>>>Thanks.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform