CxNetworkHostFind的使用如下:
void CUsbScannerDlg::OnBtnNetworkHost() { // TODO: Add your control notification handler code here m_list1.ResetContent(); NET_HOST_INFO nhi = {0}; CxNetworkHostFind local_net_host_find; BOOL bRet = local_net_host_find.FindHost(); while (bRet) { local_net_host_find.GetHostInfo(&nhi); m_list1.AddString(nhi.szMacAddr); m_list1.AddString(nhi.szIPAddr); m_list1.AddString(nhi.szName); m_list1.AddString(""); m_list1.AddString("-->Next<--"); bRet = local_net_host_find.FindNextHost(); } local_net_host_find.FindHostClose(); }
CxNetworkAdapterFind的使用如下:
void CUsbScannerDlg::OnBtnNetAdapter() { // TODO: Add your control notification handler code here m_list1.ResetContent(); NET_ADAPTER_INFO nai = {0}; CxNetworkAdapterFind local_net_host_find; BOOL bRet = local_net_host_find.FindAdapter(); while (bRet) { local_net_host_find.GetAdapterInfo(&nai); m_list1.AddString(nai.szMacAddr); m_list1.AddString(nai.szIPAddr); m_list1.AddString(nai.szName); m_list1.AddString(nai.szDescription); m_list1.AddString(""); m_list1.AddString("-->Next<--"); bRet = local_net_host_find.FindNextAdapter(); } local_net_host_find.FindAdapterClose(); }
精练的代码不需要过多解释,你们懂的。To be continued...
下载