文件名称:获取本机电脑IP地址
文件大小:43KB
文件格式:RAR
更新时间:2016-12-10 15:29:30
IP地址
获取本机电脑的IP地址Demo NCB ncb; UCHAR uRetCode; memset( &ncb, 0, sizeof(ncb) ); ncb.ncb_command = NCBRESET; ncb.ncb_lana_num = lana_num; // 指定网卡号 // 首先对选定的网卡发送一个NCBRESET命令,以便进行初始化 uRetCode = Netbios( &ncb ); memset(&ncb, 0, sizeof(ncb)); ncb.ncb_command = NCBASTAT; ncb.ncb_lana_num = lana_num; // 指定网卡号 strcpy( (char *)ncb.ncb_callname,"*" ); ncb.ncb_buffer = (unsigned char *) &Adapter; // 指定返回的信息存放的变量 ncb.ncb_length = sizeof(Adapter); // 接着,可以发送NCBASTAT命令以获取网卡的信息 uRetCode = Netbios( &ncb ); //printf("The NCBASTAT return code is: 0x%x \n", uRetCode ); if ( uRetCode == 0 ) { // 把网卡MAC地址格式化成常用的16进制形式,如0010-A4E4-5802 CString strMacMsg; strMacMsg.Format(_T("The Ethernet Number[%d] [Page]is: X-X-X-X-X-X \n") ,lana_num,Adapter.adapt.adapter_address[0],Adapter.adapt.adapter_address[1] ,Adapter.adapt.adapter_address[2],Adapter.adapt.adapter_address[3] ,Adapter.adapt.adapter_address[4],Adapter.adapt.adapter_address[5] ); TRACE(strMacMsg); }
【文件预览】:
GetMacAddress
----GetMacAddress.sln(904B)
----GetMacAddress.suo(15KB)
----GetMacAddress()
--------resource.h(685B)
--------Debug()
--------GetMacAddress.vcproj.VRGROUP.xiejingan.user(1KB)
--------stdafx.h(2KB)
--------GetMacAddress.vcproj(6KB)
--------GetMacAddress.h(483B)
--------ReadMe.txt(3KB)
--------GetMacAddressDlg.h(639B)
--------VrGetAddressCL.cpp(1KB)
--------res()
--------stdafx.cpp(144B)
--------GetMacAddress.rc(5KB)
--------VrGetAddressCL.h(373B)
--------GetMacAddress.cpp(2KB)
--------GetMacAddressDlg.cpp(3KB)
--------GetMacAddress.aps(57KB)