简体   繁体   English

如何在Windows上使用Qt检查网络接口类型是以太网还是无线?

[英]How to check network interface type is Ethernet or Wireless on Windows using Qt?

I need to find out the network interface type is Wired or Wireless on PC. 我需要找出PC上的有线或无线网络接口类型。

I have tried using QNetworkInterface class which provides Adapter Name . 我尝试使用提供Adapter Name QNetworkInterface类。 But adapter name can be changed by user on Windows. 但是Windows上的用户可以更改适配器名称。 On Mac, I can check for interface type as eth0 or eth1 since it is same for all users. 在Mac上,我可以检查接口类型为eth0eth1因为它对所有用户都是相同的。

I also tried QNetworkConfiguration::bearerType , But I am getting configuration as Ethernet ie BearerEthernet for both wired and wireless configuration. 我也尝试过QNetworkConfiguration::bearerType ,但我正在配置以太网,即有线和无线配置的BearerEthernet。

Is there any other way to find out network interface type in Qt or using Windows platform specific APIs? 有没有其他方法可以在Qt中找到网络接口类型或使用Windows平台特定的API?

这个Native Wifi API示例可以提供帮助: http//msdn.microsoft.com/en-us/library/ms706749%28v=VS.85%29.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM