圆月山庄资源网 Design By www.vgjia.com
通过以下示例,InstallShield可以用WINSOCK获取IP地址,可将以下文件保存为tcpip.rul
#define WSADESCRIPTION_LEN 256
#define WSASYS_STATUS_LEN 128
typedef
WSAData
begin
INT wVersion;
INT wHighVersion;
char szDescription[WSADESCRIPTION_LEN+1];
char szSystemStatus[WSASYS_STATUS_LEN+1];
short iMaxSockets;
short iMaxUdpDg;
POINTER lpVendorInfo;
end;
WSAData structWSAData;
WSAData POINTER pWSAData;
typedef HostEnt
begin
POINTER ph_name;
POINTER ph_aliases;
short h_addrtype;
short h_length;
POINTER ph_addr_list;
end;
HostEnt structHostEnt;
HostEnt POINTER pHostEnt;
SHORT nlen;
NUMBER nIPNetAddr;
NUMBER nVersion;
STRING szMsg;
STRING szDefault;
STRING szURL;
STRING szPath;
NUMBER nRC;
NUMBER nRC2;
STRING szHostName;
STRING szMYIPAddr;
POINTER pWinSockReturn;
typedef IPName
begin
STRING szIPAddr[100];
end;
IPName LocalIPName;
IPName POINTER pLocalIPName;
typedef IPAddrList
begin
POINTER pIPAddr;
end;
IPAddrList structIPAddrList;
IPAddrList POINTER pIPAddrList;
typedef IPAddPtr
begin
LONG nIPAddr;
end;
IPAddPtr structIPAddPtr;
IPAddPtr POINTER pIPAddPtr;
POINTER pIN_Addr_Struct;
prototype POINTER wsock32.gethostbyname(BYREF STRING);
prototype POINTER wsock32.gethostname(BYREF STRING, NUMBER);
prototype POINTER wsock32.WSAStartup(INT, POINTER);
prototype POINTER wsock32.inet_ntoa( NUMBER);
prototype POINTER wsock32.WSACleanup();
prototype int wsock32.WSAGetLastError ( );
program
pWSAData = &structWSAData;
nRC = UseDLL ("wsock32.dll");
pWSAData -> wHighVersion = 1;
pWSAData -> wVersion = 1;
nVersion = 0x02000002; // 0x01000001
pWinSockReturn = WSAStartup(nVersion, pWSAData);
pWinSockReturn = gethostname(szHostName,100);
pHostEnt = gethostbyname(szHostName);
nlen = pHostEnt -> h_length;
pIPAddPtr = pHostEnt -> ph_addr_list;
pIPAddPtr = *pIPAddPtr;
nIPNetAddr = *pIPAddPtr;
// nIPNetAddr = pIPAddPtr -> nIPAddr;
pLocalIPName = inet_ntoa( nIPNetAddr );
szMYIPAddr = pLocalIPName -> szIPAddr;
MessageBox(szMYIPAddr, INFORMATION);
WSACleanup();
exit;
#define WSADESCRIPTION_LEN 256
#define WSASYS_STATUS_LEN 128
typedef
WSAData
begin
INT wVersion;
INT wHighVersion;
char szDescription[WSADESCRIPTION_LEN+1];
char szSystemStatus[WSASYS_STATUS_LEN+1];
short iMaxSockets;
short iMaxUdpDg;
POINTER lpVendorInfo;
end;
WSAData structWSAData;
WSAData POINTER pWSAData;
typedef HostEnt
begin
POINTER ph_name;
POINTER ph_aliases;
short h_addrtype;
short h_length;
POINTER ph_addr_list;
end;
HostEnt structHostEnt;
HostEnt POINTER pHostEnt;
SHORT nlen;
NUMBER nIPNetAddr;
NUMBER nVersion;
STRING szMsg;
STRING szDefault;
STRING szURL;
STRING szPath;
NUMBER nRC;
NUMBER nRC2;
STRING szHostName;
STRING szMYIPAddr;
POINTER pWinSockReturn;
typedef IPName
begin
STRING szIPAddr[100];
end;
IPName LocalIPName;
IPName POINTER pLocalIPName;
typedef IPAddrList
begin
POINTER pIPAddr;
end;
IPAddrList structIPAddrList;
IPAddrList POINTER pIPAddrList;
typedef IPAddPtr
begin
LONG nIPAddr;
end;
IPAddPtr structIPAddPtr;
IPAddPtr POINTER pIPAddPtr;
POINTER pIN_Addr_Struct;
prototype POINTER wsock32.gethostbyname(BYREF STRING);
prototype POINTER wsock32.gethostname(BYREF STRING, NUMBER);
prototype POINTER wsock32.WSAStartup(INT, POINTER);
prototype POINTER wsock32.inet_ntoa( NUMBER);
prototype POINTER wsock32.WSACleanup();
prototype int wsock32.WSAGetLastError ( );
program
pWSAData = &structWSAData;
nRC = UseDLL ("wsock32.dll");
pWSAData -> wHighVersion = 1;
pWSAData -> wVersion = 1;
nVersion = 0x02000002; // 0x01000001
pWinSockReturn = WSAStartup(nVersion, pWSAData);
pWinSockReturn = gethostname(szHostName,100);
pHostEnt = gethostbyname(szHostName);
nlen = pHostEnt -> h_length;
pIPAddPtr = pHostEnt -> ph_addr_list;
pIPAddPtr = *pIPAddPtr;
nIPNetAddr = *pIPAddPtr;
// nIPNetAddr = pIPAddPtr -> nIPAddr;
pLocalIPName = inet_ntoa( nIPNetAddr );
szMYIPAddr = pLocalIPName -> szIPAddr;
MessageBox(szMYIPAddr, INFORMATION);
WSACleanup();
exit;
圆月山庄资源网 Design By www.vgjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
圆月山庄资源网 Design By www.vgjia.com
暂无评论...
更新日志
2024年11月15日
2024年11月15日
- 群星-时尚慢摇DJ舞曲《发烧车载中文天碟-调情》非卖品[WAV]
- 潘美辰.2008-全新重声大碟(出道20年精选纪念版)【倍特音乐】【WAV+CUE】
- 罗时丰.2002-唱歌的人(2011再生版)【贝特音乐】【WAV+CUE】
- 罗时丰.2003-唱歌的人台语精选+新歌【贝特音乐】【WAV+CUE】
- 999PUNKSTA《情绪数码故障》[Hi-Res][24bit 48kHz][FLAC/分轨][301.83MB]
- HOYO-MiX《原神-珍珠之歌4 游戏音乐》[320K/MP3][289.48MB]
- 陈崎凡《CHEN》[320K/MP3][81.13MB]
- skt都在哪一年夺冠 英雄联盟skt夺冠赛季介绍
- 炉石传说抢先体验乱斗什么时候结束 深暗领域体验乱斗结束时间
- 炉石传说抢先乱斗卡组有什么 深暗领域抢先体验乱斗卡组推荐
- 荣耀手机腕上最佳搭档 荣耀手表5首销开启
- 雷克沙ARES 6000 C28战神之翼 AMD 9800X3D超强搭档
- 咪咕快游感恩同游,超值回馈尽在咪咕咪粉节!
- 陈崎凡《CHEN》[FLAC/分轨][326.32MB]
- 群星《我们的歌第六季 第2期》[320K/MP3][74.05MB]