- 1、本文档共32页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
[理学]获取网卡地址
// Declare and initialize variables
// It is possible for an adapter to have multiple
// IPv4 addresses, gateways, and secondary WINS servers
// assigned to the adapter.
//
// Note that this sample code only prints out the
// first entry for the IP address/mask, and gateway, and
// the primary and secondary WINS server for each adapter.
CString strAdapterInfo, strTmp;
PIP_ADAPTER_INFO pAdapterInfo;
PIP_ADAPTER_INFO pAdapter = NULL;
DWORD dwRetVal = 0;
UINT i;
// variables used to print DHCP time info
struct tm newtime;
char buffer[32];
errno_t error;
ULONG ulOutBufLen = sizeof (IP_ADAPTER_INFO);
pAdapterInfo = (IP_ADAPTER_INFO *)MALLOC(sizeof (IP_ADAPTER_INFO));
if (pAdapterInfo == NULL)
{
TRACE(Error allocating memory needed to call GetAdaptersinfo\n);
return;
}
// Make an initial call to GetAdaptersInfo to get
// the necessary size into the ulOutBufLen variable
if (GetAdaptersInfo(pAdapterInfo, ulOutBufLen) == ERROR_BUFFER_OVERFLOW)
{
FREE(pAdapterInfo);
pAdapterInfo = (IP_ADAPTER_INFO *) MALLOC(ulOutBufLen);
if (pAdapterInfo == NULL)
{
TRACE(Error allocating memory needed to call GetAdaptersinfo\n);
return;
}
}
if ((dwRetVal = GetAdaptersInfo(pAdapterInfo, ulOutBufLen)) == NO_ERROR)
{
pAdapter = pAdapterInfo;
CString strGroupName, strSubItemName, strSubItemValue, strSubItemDescr;
CBCGPProp* pNETGroup = new CBCGPProp(_T(网络信息));
while (pAdapter)
{
USES_CONVERSION;
strTmp.Format(_T(序号:%d\r\n), pAdapter-ComboIndex);
strAdapterInfo += strTmp;
strTmp.Format(_T(名称:%s\r\n), A2W(pAdapter-AdapterName));
strAdapterInfo += strTmp;
strTmp.Format(_T(描述:%s\r\n), A2W(pAdapter-Description));
strAdapterInfo += strTmp;
strGroupName = A2W(pAdapter-De
文档评论(0)