<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 設計應用 > 獲取網(wǎng)卡的相關(guān)信息的C++源碼

獲取網(wǎng)卡的相關(guān)信息的C++源碼

作者: 時(shí)間:2012-06-26 來(lái)源:網(wǎng)絡(luò ) 收藏

 //////////////////////////////////////////////////////////////////

本文引用地址:http://dyxdggzs.com/article/148848.htm

  #include stdafx.h

  #include

  #include

  #include Iphlpapi.h

  using namespace std;

  PIP_ADAPTER_INFO pinfo=NULL;

  unsigned long len=0;

  CString macaddress;

  CString  description;

  CString  type;

  CString  subnet;

  CString  IpAddress;

  CString  gateway;

  CString  PrimaryWinsServer;

  CString  dhcp;

  void GetInfo();

  void ParseData();

  void OutPut(CString str);

  void main()

  {

  cout------------------------檢測---------------------n;

  GetInfo();

  }

  void GetInfo()

  {

  if (pinfo!=NULL)

  delete (pinfo);

  unsigned long nError;

  nError  =  GetAdaptersInfo(pinfo,len); //1??üoˉêy

  if (nError==0)

  {

  ParseData();

  }

  if (nError==ERROR_NO_DATA)

  {

  OutPut(沒(méi)有網(wǎng)絡(luò )設備);

  }

  if (nError==ERROR_NOT_SUPPORTED)

  {

  OutPut(GetAdaptersInfo不支持本系統);

  }

  if (nError==ERROR_BUFFER_OVERFLOW)

  {

  pinfo= (PIP_ADAPTER_INFO)malloc(len);

  nError  =  GetAdaptersInfo(pinfo,len);

  if (nError==0)

  {

  ParseData();

  }

  }

  return;

  }

  void ParseData()

  {

  if (pinfo!=NULL)

  {

  macaddress.Format(%02X:%02X:%02X:%02X:%02X:%02X,pinfo->Address[0],pinfo->Address[1],pinfo->Address[2],pinfo->Address[3],pinfo->Address[4],pinfo->Address[5]);

  description  =  pinfo->Description;

  type.Format(%d,pinfo->Type);

  PIP_ADDR_STRING pAddressList = (pinfo->IpAddressList);

  IpAddress  =;

  do

  {

  IpAddress  +=  pAddressList->IpAddress.String;

  pAddressList = pAddressList->Next;

  if (pAddressList != NULL)

  IpAddress  +=rn;

  } while (pAddressList != NULL);

  subnet.Format(%s,pinfo->IpAddressList.IpMask.String);

  gateway.Format(%s,pinfo->GatewayList.IpAddress.String);

  if (pinfo->HaveWins)

  PrimaryWinsServer.Format(%s,pinfo->PrimaryWinsServer.IpAddress.String );

  else

  PrimaryWinsServer.Format(%s,N/A );

  if (pinfo->DhcpEnabled )

  dhcp.Format(%s,pinfo->DhcpServer.IpAddress.String );

  else

  dhcp.Format(%s,N/A);

  pinfo = pinfo->Next;

  }

  OutPut(網(wǎng)絡(luò )設備為:t+description);

  OutPut(Mac地址為:t+macaddress);

  OutPut(類(lèi)型:t+type);

  OutPut(IP地址:t+IpAddress);

  OutPut(子網(wǎng)掩碼:t+subnet);

  OutPut(網(wǎng)關(guān):t+gateway);

  OutPut(主Wins服務(wù)器:t+PrimaryWinsServer);

  OutPut(dhcp服務(wù)器:t+dhcp);

  }

  void OutPut(CString str)

  {

  cout

  }

c++相關(guān)文章:c++教程




評論


相關(guān)推薦

技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>