#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->ADDRESS[4], PIPHELPER->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