How to detect Network type on Win Mobile

僤鯓⒐⒋嵵緔 提交于 2019-12-12 02:47:06

问题


I spend lot of time searching how to determine the current network type such as WIFI, 3G, Ethernet. But I cannot find any information online in windows platform.

I want to detect the Ethernet network type, but I cannot find any API that can retrieve the network type. I've find Connection Manager for keyword but there's less information.

Did anyone have any idea? Please help me...I was blocked by this for 2 weeks.

Thanks.


回答1:


Look in the registry key HKLM\system\state\connections, there is are entries for each of the possible network types, for instance:

When connected to a wireless network:

[HKLM\system\state\Connections\Network]
Adapters="BCMSDDHD1"
Count=dword:00000001
Descriptions="Business World"

when connected to activesync:

[HKLM\system\state\Connections\Desktop]
Adapters=""
Count=dword:00000001
Descriptions="CurrentDTPTNetwork"

The Count value under HKLM\system\state\connections gives you the total number of active connections.

In HKLM\system\state\Hardware you can find the current power state of the various devices.




回答2:


There is an API on Windows Mobile that makes it easier to access these values vs. going directly to the registry. See the SystemState class documentation, specifically the ConnectionsNetworkCount and ConnectionsCount properties.



来源:https://stackoverflow.com/questions/8784437/how-to-detect-network-type-on-win-mobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!