//扫描局域网中IP地址和MAC地址 
//“172.16.31.1”
int scanip = 0;
int scanmac = 1;

char OnButton() 
{
        //目的mac地址,全为1 广播发送
        u_char DestMac[6] = {0XFF,0XFF,0XFF,0XFF,0XFF,0XFF};
        ULONG uLen =6;

    //IP增加
    BYTE f0, f1, f2, f3;
        //m_ipadd IP控件变量
    m_ipadd.GetAddress(f0, f1, f2, f3); 
    
    CString m_addr;

   for(f3 = 1; f3 < 255; f3++)
   {
           m_addr.Format("%d%s%d%s%d%s%d", f0, ".", f1, ".", f2, ".", f3);

       if(NO_ERROR ==SendARP(inet_addr(m_addr),0,(ULONG *)DestMac,&uLen) )
             {
                     u_char *szdestmac = DestMac;
                         //在列表框中显示IP,m_ipmac列表框变量
                     m_ipmac.InsertItem(scanip,m_addr);
                         scanip++;
                     TCHAR msg[200];
                     wsprintf(msg,"%02X-%02X-%02X-%02X-%02X-%02X",szdestmac[0],szdestmac[1],szdestmac[2],szdestmac[3],szdestmac[4],szdestmac[5]);
                     //在列表框中显示MAC地址
                         m_ipmac.SetItemText(0,scanmac,msg);
                         scanmac++;
              }
   }
    
        
}
编译通不过恳请大伙帮忙看看下 那里写错了 谢谢啊 !