>>>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 >>>>>>
>>>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 >>>>>>