C ++:获取Vista上的网络适配器的MAC地址? [英] C++: Get MAC address of network adapters on Vista?

查看:145
本文介绍了C ++:获取Vista上的网络适配器的MAC地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前正在使用 NetBios方法,它的工作原理XP。在Vista下的初步测试表明,它也可以工作,但有一些警告 - 例如,NetBIOS必须存在,并且从我一直在读,适配器的顺序必然改变。我们的替代方法(使用 SNMPExtensionQuery )似乎在Vista下遭到破坏。 / p>

问题是:你知道在Vista机器上获取本地MAC地址列表的可靠方法吗?向后兼容XP是一个加号(我宁愿有一个单一的方法,而不是丑陋的#ifdef的)。感谢!

解决方案

您可以使用 WMIService ?我用它来获取一台机器的mac地址在Vista之前的日子。


We are currently using the NetBios method, and it works ok under XP. Preliminary tests under Vista show that it also works, but there are caveats - NetBIOS has to be present, for instance, and from what I've been reading, the order of the adapters is bound to change. Our alternative method - with SNMPExtensionQuery - seems to be broken under Vista.

The question is: do you know of a reliable way to get a list of the local MAC addresses on a Vista machine? Backwards compatibility with XP is a plus (I'd rather have one single method than lots of ugly #ifdef's). Thanks!

解决方案

Could you use the WMIService? I used it to get the mac-address of a machine in pre-Vista days though.

这篇关于C ++:获取Vista上的网络适配器的MAC地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆