Code to obtain an IP address by host name in InstallShield _ Other
Source: Internet
Author: User
FileName: Setup.rul
Scripting feature: Obtaining TCP/IP addresses via host name
Date of preparation: 2003-07-15
How to use: Call function fgetipaddress (Szhost, szipadress)
Written by Jaron, 2002-07-15
Original source: Jiangdu Information Network forum Http://www.jiangdu.net/bbs;
Reprint please indicate the source and retain this copyright information
Welcome to use Sitemanager website management system http://sitemanager.cnzone.net;;
#include "Sddialog.h"
#include "Ipaddress.rul"
STRING szipaddress;
STRING Szhostname;
BOOL Nresult;
Program
SdShowDlgEdit1 ("", "Please enter your host name", "Host Name:", Szhostname);
Nresult = Fgetipaddress (Szhostname, szipaddress);
If Nresult Then
MessageBox ("IP address is:" + szipaddress, information);
endif
Endprogram
#include "Sddialog.rul"
==========================
FileName: Ipaddress.rul
Scripting feature: Obtaining TCP/IP addresses via host name
Date of preparation: 2003-07-15
How to use:
1. Join #include "Ipaddress.rul" in front of Setup.rul
2. Call function fgetipaddress (Szhost, szipadress)
Written by Jaron, 2002-07-15
Original source: Jiangdu Information Network forum Http://www.jiangdu.net/bbs;
Reprint please indicate the source and retain this copyright information
Welcome to use Sitemanager website management system http://sitemanager.cnzone.net;;
Prototype number WSOCK32. WSAStartup (number, pointer);
Prototype number Wsock32.gethostbyname (STRING);
Prototype number KERNEL32. RtlMoveMemory (pointer, number, number);
Prototype number WSOCK32. WSACleanup ();
Prototype Fgetipaddress (string, BYREF string);
typedef wsadata
Begin
INT wversion;
INT whighversion;
STRING szdescription[255];
STRING szsystemstatus[128];
INT imaxsockets;
INT IMAXUDPDG;
INT Lpszvendorinfo;
End
typedef hostent
Begin
Number Hname; As Long
Number haliases; As Long
Short Haddrtype; As Integer
Short hlength; As Integer
Number haddrlist; As Long
End
typedef ipaddress
Begin
CHAR B1; The
CHAR B2; Second
CHAR B3; Third
CHAR b4; Fourth
End
function fgetipaddress (szhost, szipadress)
Wsadata Structwsadata;
Wsadata pointer pstructwsadata;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.