Get host information for the local computer

Source: Internet
Author: User

#include <afxcmn.h>//MFC support for Windows Common controls#endif//_afx_no_afxcmn_support  #include "Iphel Per/iphlpapi.h "#pragma comment (lib," Iphelper/iphlpapi. LIB ")   dword dwlen = 0, Dwerror; dwerror = GetAdaptersInfo (NULL, &dwlen);  piphelper = (PIP_ Adapter_info) malloc (dwlen);  dwerror = GetAdaptersInfo (Piphelper, &dwlen);   cstring StrMAC;  strmac.format ("%02x-%02x-%02x-%02x-%02x-%02x", piphelper->address[0],\     pIPHelper-> ADDRESS[1], piphelper->address[2], piphelper->address[3],\    &NBSP;PIPHELPER-&GT;ADDRESS[4], PIPHELPER-&GT;ADDRESS[5]);  pip_addr_string paddrlist = &piphelper->ipaddresslist; cstring m_ IpAddress = "";  while (paddrlist! = NULL)  {   cstring straddr = paddrlist->ipaddress.string;    paddrlist = paddrlist->next;   m_comaddr.addstring (straddr);  } cstring Strsubmask, Strgateway; strsubmask.format ("%s ", piphelper->ipaddresslist.ipmask.string);  strgateway.format ("%s ", piphelper-> GatewayList.IpAddress.String);  m_strmac = Strmac; m_strsub = Strsubmask; m_strgate = Strgateway;  m_comaddr.setcursel (0);  free (Piphelper);

Get host information for the local computer

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.