常春岛资源网 Design By www.syssdc.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.syssdc.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
常春岛资源网 Design By www.syssdc.com
暂无评论...
更新日志
2024年11月15日
2024年11月15日
- 杨林.1989-留一点爱来爱自己【综一唱片】【WAV+CUE】
- 南合文斗.2007-陪君醉笑三千尘鸟人唱片】【FLAC+CUE】
- 群星《我们的歌第六季 第1期》[320K/MP3][90.72MB]
- 群星《我们的歌第六季 第1期》[FLAC/分轨][456.01MB]
- 李雨寰《Break Free》[320K/MP3][98.39MB]
- 草蜢.2001-《真经典》环球唱片[WAV+CUE]
- 群星.2009-第4届2008十大发烧唱片精选[FLAC+CUE]
- 丁红《女儿情》[DTS-WAV]
- 陈惠婷.2017-Voyager3【亚神音乐】【FLAC分轨】
- 群星.2001-华纳歌声魅影【华纳】【WAV+CUE】
- 张雨生.2016-雨后星空2CD【丰华】【WAV+CUE】
- 李雨寰《Break Free》[FLAC/分轨][533MB]
- 廖也欧《面朝大海》[320K/MP3][18.35MB]
- 廖也欧《面朝大海》[Hi-Res][24bit 48kHz][FLAC/分轨][170.14MB]
- s13T1夺冠五人名单都有谁 s13T1夺冠五人名单一览