导入netapi32.lib和"nb30.h"
CString strMac;
    NCB ncb;
    ADAPTER_STATUS adapt;
    memset(
&ncb,0,sizeof(ncb));
    ncb.ncb_command 
= NCBRESET;    
    
//首先对网卡发送一个NCBRESET命令以便进行初始化 
    Netbios(&ncb);
    ncb.ncb_command 
= NCBASTAT;
    strcpy((
char *)ncb.ncb_callname,"*");
    
// 指定返回的信息存放的变量 
    ncb.ncb_buffer = (unsigned char *)&adapt;
    ncb.ncb_length 
= sizeof(adapt);
    
// 发送NCBASTAT命令以获取网卡的信息 
    Netbios(&ncb);
    
// 把网卡MAC地址格式化成常用的16进制形式     
    strMac.Format( "%02X%02X-%02X%02X-%02X%02X\n",
                    adapt.adapter_address[
0],
                    adapt.adapter_address[
1],
                    adapt.adapter_address[
2],
                    adapt.adapter_address[
3],
                    adapt.adapter_address[
4],
                    adapt.adapter_address[
5]);
    m_edit.SetWindowText(strMac);