检测计算机是否在 Windows 上使用移动连接 (3G/EDGE/GPRS)
我需要确定计算机是否使用移动连接(例如 3G、EDGE、GPRS)连接到互联网。我发现这个相同的问题,但接受的答案不是很对我有帮助... System.Net.NetworkInformation.NetworkInterface
类公开了一些属性,但没有任何内容可以帮助我确定它是否是移动连接。
我的应用程序位于 .NET 中,但我也对涉及 Win32 或 WMI 的解决方案感兴趣
I need to determine if the computer is connected to the Internet using a mobile connection (e.g. 3G, EDGE, GPRS). I found this identical question, but the accepted answer isn't very helpful to me... The System.Net.NetworkInformation.NetworkInterface
class exposes a few properties, but nothing that can help me determine if it is a mobile connection.
My application is in .NET, but I'm also interested in solutions involving Win32 or WMI
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为如果您查询活动设备的 移动宽带状态,因为如果它是移动宽带设备,它应该返回状态,但否则我认为它会返回错误。
本文MB 微型端口驱动程序初始化,有一个图表显示如何做这样的事情。引自该页面:下图表示确定接口是否符合 MB 接口资格并收集有关设备功能的信息的过程。
我自己从未尝试过,所以我不确定上面的内容,我无法显示任何示例代码,但有一个示例部分可能包含一些有用的内容:网络示例
编辑:旧新闻组中名为 Norman Diamon 的人的代码片段 发布
I think it might work if you query the active device for it's Mobile Broadband status, since if it's a Mobile Broadband device it should return the status, but otherwise I assume it would return an error.
This article, MB Miniport Driver Initialization, has a diagram showing how to do something like this. Quote from that page: The following diagram represents the process taken to determine whether the interface is qualified as an MB interface and to gather information about the device capabilities.
Never tried it myself, so I'm not certain of the above and I can't show any sample code but there's a section for samples that might contain something useful here: Network Samples
Edit: Code snippet by someone called Norman Diamon in an old newsgroup posting