ehxz 发表于 2007-3-20 11:04:02

[转帖]PB之获取本机IP

<div style="FONT-SIZE: 13px;">声明win32 API函数:<br/>function int WSAStartup( uint UIVersionRequested, ref s_WSAData lpWSAData ) library "wsock32.dll"<br/>function int WSACleanup() library "wsock32.dll"<br/>function int WSAGetLastError ( ) library "wsock32.dll"<br/>function int gethostname ( ref string name, int namelen ) library "wsock32.dll"<br/>function string GetHost(string lpszhost, ref blob lpszaddress ) library "pbws32.dll" <br/><br/>使用方法:<br/>s_wsadata l_WSAData<br/>string ls_HostName = space(128)<br/>string ls_IpAddress<br/>int li_version = 257<br/>blob{4} lb_hostaddress <br/><br/>IF wsastartup ( li_version, l_WSAData ) = 0 THEN<br/><br/>IF gethostname ( ls_HostName, len(ls_HostName) ) &lt; 0 THEN<br/>messagebox("GetHostName",WSAGetLastError())<br/>ELSE<br/>GetHost(ls_HostName, lb_HostAddress)<br/>ls_IpAddress = string(asc(string(blobmid(lb_HostAddress,1,1))),"000")&nbsp; &nbsp;"."<br/>ls_IpAddress&nbsp;&nbsp;= string(asc(string(blobmid(lb_HostAddress,2,1))),"000")&nbsp; &nbsp;"."<br/>ls_IpAddress&nbsp;&nbsp;= string(asc(string(blobmid(lb_HostAddress,3,1))),"000")&nbsp; &nbsp;"."<br/>ls_IpAddress&nbsp;&nbsp;= string(asc(string(blobmid(lb_HostAddress,4,1))),"000")<br/>END IF<br/>WSACleanup()<br/>ELSE<br/>messagebox("GetHostName",WSAGetLastError())<br/>END IF <br/>sle_1.text=ls_hostname<br/>sle_2.text=ls_ipaddress</div>
页: [1]
查看完整版本: [转帖]PB之获取本机IP

免责声明:
本站所发布的一切破解补丁、注册机和注册信息及软件的解密分析文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。

Mail To:Admin@SybaseBbs.com