请指点VFP如何通过域名获取IP?在网上下载的程序结果是0.0.0.0,请指点多谢!
DECLARE INTEGER gethostbyname in WSOCK32 String
DECLARE INTEGER WSAStartup IN ws2_32 INTEGER,STRING @
DECLARE INTEGER WSACleanup IN ws2_32
#DEFINE WSADATA_SIZE 398
#DEFINE WS_VERSION 0x0202
uHostName='www.'
cWSADATA=Repli(Chr(0),WSADATA_SIZE)
WSAStartup(WS_VERSION, @cWSADATA)
ret=gethostbyname(uHostName)
n=AT(uHostName,SYS(2600,ret,WSADATA_SIZE))
IPDATA=SUBSTR(SYS(2600,ret,WSADATA_SIZE),n-4,4)
uIpStr=''
FOR i=1 TO 4
uIpStr=uIpStr+ALLTRIM(STR(ASC(SUBSTR(IPDATA,i,1))))+'.'
ENDF
WSACleanup()
MESSAGEBOX(uHostName+0h0D0A+LEFT(uIpStr,LEN(uIpStr)-1))