Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Obtener Dirección IP
Message
De
13/05/2003 15:28:18
 
 
À
13/05/2003 13:18:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00787812
Message ID:
00787873
Vues:
13
This message has been marked as the solution to the initial question of the thread.
Trabaja esto para usted?
PUBLIC IPSocket
crlf=CHR(13)+CHR(10)
* Show local ip address
IPSocket = CREATEOBJECT("MSWinsock.Winsock")
IF TYPE('IPSocket')='O'
	IPAddress = IPSocket.LocalIP
	localhostname=IPSocket.localhostname
	remotehost=IPSocket.remotehost
	remotehostip=IPSocket.remotehostip
	MESSAGEBOX ("Local IP = " + IPAddress+crlf+"local host = "+localhostname;
		+crlf+"Remotehost = "+remotehost+crlf+"Remotehostip = "+remotehostip)
ELSE
	MESSAGEBOX ("Winsock Is Not Installed!")
ENDIF

* or

LOCAL lcTempFile, loWSH, lcLocalIP
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
	lcLocalIP=UPPER(FILETOSTR(lcTempFile))
	lcLocalIP=SUBSTR(lcLocalIP, AT('IP ADDRESS',lcLocalIP))
	lcLocalIP=SUBSTR(lcLocalIP, AT(':',lcLocalIP)+2)
	lcLocalIP=SUBSTR(lcLocalIP, 1, AT(CHR(13),lcLocalIP)-1)
	MESSAGEBOX(lcLocalIP)
ENDIF
Perdon si no entendiera.

>He estado tratando de obtener una dirección IP de usuarios que ingresan a un sistema, revise el programa registry.prg que se instala con el visual Fox, mas no me queda claro que libería debo de usuar. Tambien revise el archivo WIN32API y me encontre con una sección que trae la siguente linea.
>
>Declare Function NetWkstaGetInfo Lib "Netapi32.dll" (lpServer As Any, ByVal Level As Long, lpBuffer As Any) As Long
>
>Esto me hace suponer que la librería NETapi32 me propocinara la información que necesito mas como es una consulta con estructura me falta información de como funciona relamente estas llamadas.
>
>Les agradecería cualquier ayuda que me propocionaran.
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform