unit IPHlpAPI;
interface
uses
Windows,SysUtils,Classes;
const
MAX_ADAPTER_DESCRIPTION_LENGTH=128;
MAX_ADAPTER_NAME_LENGTH=256;
MAX_ADAPTER_ADDRESS_LENGTH=8;
DEFAULT_MINIMUM_ENTITIES=32;
MAX_HOSTNAME_LEN=128;
MAX_DOMAIN_NAME_LEN=128;
MAX_SCOPE_ID_LEN=256;
ERROR_NO_DATA:LongInt=232;
ERROR_NOT_SUPPORTED:LongInt=50;
ERROR_INVALID_PARAMETER:LongInt=87;
ERROR_BUFFER_OVERFLOW:LongInt=111;
type
time_t=Integer;
IP_ADDRESS_STRING=packed record
Addr:array [0..15] of Char;
end;
PIP_ADDRESS_STRING=^IP_ADDRESS_STRING;
IP_MASK_STRING=IP_ADDRESS_STRING;
PIP_MASK_STRING=^IP_MASK_STRING;
PIPAdapterInfo=^TIPAdapterInfo;
TIPAdapterInfo=packed record
Next
IPAdapterInfo;//下一个节点的指针
ComboIndex
WORD;
AdapterName:array [0..MAX_ADAPTER_NAME_LENGTH + 3] of Char;
//适配器名称
Description:array [0..MAX_ADAPTER_DESCRIPTION_LENGTH + 3] of Char;
//适配器描述信息
AddressLength:UINT;//Address域的最大长度,传递MAX_ADAPTER_ADDRESS_LENGTH常量即可
Address:array [0..MAX_ADAPTER_ADDRESS_LENGTH-1] of Byte;//适配器物理地址
Index
WORD;
uType:UINT;
DhcpEnabled:UINT;
CurrentIpAddress
IP_ADDRESS_STRING;
IpAddressList:IP_ADDRESS_STRING;
GatewayList:IP_ADDRESS_STRING;
DhcpServer:IP_ADDRESS_STRING;
HaveWins:BOOL;
PrimaryWinsServer:IP_ADDRESS_STRING;
SecondaryWinsServer:IP_ADDRESS_STRING;
LeaseObtained:time_t;
LeaseExpires:time_t;
end;
//此函数功能最强大,而且只要求网卡在系统中可用,并不要求一定连接上网络
function GetAdaptersInfo(Buf
IPAdapterInfo;var BufLen:ULONG)
WORD;stdcall;
implementation
function GetAdaptersInfo;external 'iphlpapi.dll' name 'GetAdaptersInfo';
end.
这段代码如何调用,请高手给写个调用方法