Searching for internal and external ip-address - solved

Searching for internal and external ip-address - solved

Postby driessen » Tue Jan 15, 2013 12:56 pm

Hello,

For a very long time, I use this tool to search for my internal and external ip-address :
Code: Select all  Expand view

******************************************************************************
#INCLUDE "FIVEWIN.CH"
#DEFINE DEFAULT(xVar,xVal) xVar=IF(xVar=NIL,xVal,xVar)
******************************************************************************

FUNCTION IP_ADRES(nSec)

   LOCAL oHttp

   LOCAL cVar1     := ""
   LOCAL cVar2     := ""
   LOCAL cSec      := 0

   LOCAL cIPADRES1 := "www.dnsstuff.com/docs/ipall"
   LOCAL cIPADRES2 := "Your IP Address: <strong>"
   LOCAL cIPADRES3 := "</strong>"

   DEFAULT(nSec,"0")

   cSec := VAL(nSec)

   WsaStartUp()
   cVar1 := GetHostByName(GetHostName())
   WsaCleanUp()

   oHttp := CreateObject("winhttp.winhttprequest.5.1")
   oHttp:Open("GET","http://"+ALLTRIM(cIPADRES1),.f.)
   oHttp:Send()
   cVar2 := oHttp:ResponseText()
   cVar2 := StrExtract(cVar2,ALLTRIM(cIPADRES2),ALLTRIM(cIPADRES3))

    IF cSec = 0
        MsgAlert(IF(!EMPTY(cVar1),"Your current internal ip-address is : "+ALLTRIM(cVar1)+IF(!EMPTY(cVAR2),CHR(13)+CHR(13),""),"") + IF(!EMPTY(cVar2),"Your current external ip-address is : "+ALLTRIM(cVar2),""),"Message")
    ELSE
        MsgWait(IF(!EMPTY(cVar1),"Your current internal ip-address is : "+ALLTRIM(cVar1)+IF(!EMPTY(cVAR2),"       -       ",""),"") + IF(!EMPTY(cVar2),"Your current external ip-address is : "+ALLTRIM(cVar2),""),"Message",cSec)
    ENDIF

   QUIT

RETURN(.T.)

******************************************************************************

STATIC FUNCTION StrExtract(cText,cAfter,cBefore)

   LOCAL cRet := SUBSTR(cText,AT(cAfter,cText) + LEN(cAfter))
   LOCAL n

   IF (n := AT(cBefore,cRet)) > 0
      cRet := LEFT(cRet,n - 1)
   ENDIF

RETURN(cRet)

******************************************************************************

FUNCTION OleInvoke(hObj,cMethod,uParam)

#IFNDEF __XHARBOUR__
   RETURN __ObjSendMsg(TOleAuto():New(hObj),cMethod,uParam)
#ELSE
   LOCAL aParams := hb_aParams()
   aParams[1] := TOleAuto():New(hObj)
   RETURN hb_execFromArray(@__ObjSendMsg(),aParams)
#ENDIF

******************************************************************************

FUNCTION OleSetProperty(hObj,cPropName,uValue)

RETURN __ObjSendMsg(TOleAuto():New(hObj),"_" + cPropName,uValue)

******************************************************************************

FUNCTION OleGetProperty(hObj,cPropName)

RETURN __ObjSendMsg(TOleAuto():New(hObj),cPropName)

******************************************************************************
 
Since last week, this function isn't working anymore allthough I didn't change it a single character.

Anyone who knows what is wrong ?

Thank you in advance for any help.
Last edited by driessen on Tue Jan 15, 2013 2:01 pm, edited 1 time in total.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Searching for internal and external ip-address

Postby ADutheil » Tue Jan 15, 2013 1:26 pm

Change to:
LOCAL cIPADRES2 := [Your IP Address: <strong class="ipBlock">]
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Searching for internal and external ip-address - Solved

Postby driessen » Tue Jan 15, 2013 2:00 pm

André,

Thank you very much.

Problem is solved.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], JoséQuintas and 37 guests