get ip,mac
来源:互联网 发布:sqlserver存储过程list 编辑:程序博客网 时间:2024/06/08 09:22
DWORD Err;
PFIXED_INFO pFixedInfo;
DWORD FixedInfoSize = 0;
PIP_ADAPTER_INFO pAdapterInfo, pAdapt;
DWORD AdapterInfoSize;
PIP_ADDR_STRING pAddrStr;
Memo1->Lines->Clear();
// Get the main IP configuration information for this machine using a FIXED_INFO structure
if ((Err = GetNetworkParams(NULL, &FixedInfoSize)) != 0)
{
if (Err != ERROR_BUFFER_OVERFLOW)
{
Memo1->Lines->Add("GetNetworkParams sizing failed with error"+AnsiString(Err));
return;
}
}
// Allocate memory from sizing information
if ((pFixedInfo = (PFIXED_INFO) GlobalAlloc(GPTR, FixedInfoSize)) == NULL)
{
Memo1->Lines->Add("Memory allocation error");
return;
}
if ((Err = GetNetworkParams(pFixedInfo, &FixedInfoSize)) == 0)
{
Memo1->Lines->Add("Host Name :"+AnsiString(pFixedInfo->HostName));
pAddrStr = pFixedInfo->DnsServerList.Next;
}
else
{
Memo1->Lines->Add("GetNetworkParams failed with error "+Err);
return;
}
//
// Enumerate all of the adapter specific information using the IP_ADAPTER_INFO structure.
// Note: IP_ADAPTER_INFO contains a linked list of adapter entries.
//
AdapterInfoSize = 0;
if ((Err = GetAdaptersInfo(NULL, &AdapterInfoSize)) != 0)
{
if (Err != ERROR_BUFFER_OVERFLOW)
{
Memo1->Lines->Add("GetAdaptersInfo sizing failed with error "+Err);
return;
}
}
// Allocate memory from sizing information
if ((pAdapterInfo = (PIP_ADAPTER_INFO) GlobalAlloc(GPTR, AdapterInfoSize)) == NULL)
{
Memo1->Lines->Add("Memory allocation error/n");
return;
}
// Get actual adapter information
if ((Err = GetAdaptersInfo(pAdapterInfo, &AdapterInfoSize)) != 0)
{
Memo1->Lines->Add("GetAdaptersInfo failed with error %d/n"+Err);
return;
}
pAdapt = pAdapterInfo;
while (pAdapt)
{
int i=1;
Memo1->Lines->Add("Physical Address : ");
String str="";
for (int i=0; i <6; i++)
{
if (i>0)
str=str+"-";
str=str+IntToHex(int(pAdapt->Address[i]),2);
}
Memo1->Lines->Add(str);
pAddrStr = &(pAdapt->IpAddressList);
while(pAddrStr)
{
Memo1->Lines->Add("IP Address : "+AnsiString(pAddrStr->IpAddress.String));
pAddrStr = pAddrStr->Next;
}
while(pAddrStr)
{
Memo1->Lines->Add(AnsiString(pAddrStr->IpAddress.String));
pAddrStr = pAddrStr->Next;
}
pAdapt = pAdapt->Next;
}
- get ip,mac
- get ip address & mac address
- linux上获得本地IP地址和MAC地址(get local ip address and mac address)
- ip mac
- ip ip mac
- get mac地址
- get mac address
- Get Mac Address
- IPV6 get mac(NDP)
- Mac使用apt-get
- Mac使用apt-get
- Mac使用apt-get
- get ip address
- get ip(php)
- Get IP Address
- local host ip get
- get g-ip
- get real ip
- 自定义异常类
- u/linux 系统编程问答
- FLEX实践:动态显示DataGrid的列和内容
- “一分钟先生”之“向上管理”
- 给gridview添加checkBox 并且做全选功能
- get ip,mac
- c#中的反射代码实例讲解(转载)
- deiphi开发
- PE病毒技术剖析[转载]
- Windows2003 远程桌面超过最大连接数解决办法
- HTML XHTML
- doctype声明 过渡transitional 严格strict 框架frameset
- Linux 版本查询命令
- 40 个轻量级 JavaScript 库