当前位置: 代码迷 >> PB >> 求pbws32.dll(获取本地IP),用完后小弟我将上传空间,给其他人下载
  详细解决方案

求pbws32.dll(获取本地IP),用完后小弟我将上传空间,给其他人下载

热度:20   发布时间:2016-04-29 08:20:12.0
求pbws32.dll(获取本地IP),用完后我将上传空间,给其他人下载
这个组件好难找,都是通过相互赠送而得。

希望有人能发我邮箱里,并留言,我好给分,并表示万分的感谢!

同时,我也上传它到某空间里,供大家下载。

------解决方案--------------------
获取本机IP

声明win32 API函数:
function int WSAStartup( uint UIVersionRequested, ref s_WSAData lpWSAData ) library "wsock32.dll "
function int WSACleanup() library "wsock32.dll "
function int WSAGetLastError ( ) library "wsock32.dll "
function int gethostname ( ref string name, int namelen ) library "wsock32.dll "
function string GetHost(string lpszhost, ref blob lpszaddress ) library "pbws32.dll "

使用方法:
s_wsadata l_WSAData
string ls_HostName = space(128)
string ls_IpAddress
int li_version = 257
blob{4} lb_hostaddress

IF wsastartup ( li_version, l_WSAData ) = 0 THEN

IF gethostname ( ls_HostName, len(ls_HostName) ) < 0 THEN
messagebox( "GetHostName ",WSAGetLastError())
ELSE
GetHost(ls_HostName, lb_HostAddress)
ls_IpAddress = string(asc(string(blobmid(lb_HostAddress,1,1))), "000 ") + ". "
ls_IpAddress += string(asc(string(blobmid(lb_HostAddress,2,1))), "000 ") + ". "
ls_IpAddress += string(asc(string(blobmid(lb_HostAddress,3,1))), "000 ") + ". "
ls_IpAddress += string(asc(string(blobmid(lb_HostAddress,4,1))), "000 ")
END IF
WSACleanup()
ELSE
messagebox( "GetHostName ",WSAGetLastError())
END IF
sle_1.text=ls_hostname
sle_2.text=ls_ipaddress


------解决方案--------------------
用wsock32.dll很好啊
我有你要的dll
  相关解决方案