Listing and connecting WiFi using WinRt

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 03:39:09

问题


In my office I have 10 WiFi routers.I want to list all those(similar to Network icon in the system tray on windows 8) and connect/disconnect to one of them through Win Rt.

I tried these API

 Windows::Networking::Connectivity::NetworkInformation::GetLanIdentifiers();
 Windows::Networking::Connectivity::NetworkInformation::GetConnectionProfiles();
 NetworkInformation::GetInternetConnectionProfile();

but these Api only list connected one, it doesn't list others

I can achieve this using http://msdn.microsoft.com/en-us/library/windows/desktop/ms706716(v=vs.85).aspx. But I am not sure this Api will be supported on Windows 8 metro mode.

Does WinRt provides Api support for this ??


回答1:


You cannot connect/disconnect to a network from a Windows App. You can only check informations. The reason is (for Microsoft) that the connection manager is accessible from your app through the charms bar.

This functionality is not exposed to Metro style applications. An operator's app can create profiles for their networks (with known SSIDs), but listing and connecting to visible networks is controlled by the user via the Windows connection management UI, not by an application. [Mike Bishop [MSFT], here]

The advanced connectivity functionnalities are present in Windows.Networking.NetworkOperators, which functionalities are only available to mobile operator apps and Windows Store apps given privileged access by mobile network operators.

Take a look at the Microsoft's Network information sample which shows what you can achieve with this API.



来源:https://stackoverflow.com/questions/13815621/listing-and-connecting-wifi-using-winrt

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