Is there a way of getting ConnectionStatus from IVpnProfile in a UWP application?

微笑、不失礼 提交于 2019-11-28 03:17:19

问题


I have the following WinRT code which works fine to discover active VPN Profiles:

VpnManagementAgent vpn;
auto profiles = vpn.GetProfilesAsync().get();
wprintf(L"Found %d profiles\n", profiles.Size());
for (auto vp : profiles)
{
    wprintf(L"Found profile %s\n", vp.ProfileName().c_str());
}

I would like to check the ConnectionStatus but this is not available on the IVpnProfile interface. I have tried adding the following to no avail as ConnectionStatus is available in the concrete VpnPlugInProfile and VpnNativeProfile classes:

VpnPlugInProfile pp = vp.as<VpnPlugInProfile>();
if (pp != nullptr)
    wprintf(L"ConnectionStatus = %d\n", pp.ConnectionStatus());

This just give an Invalid Handle error.

Is there a way of getting ConnectionStatus from IVpnProfile?

来源:https://stackoverflow.com/questions/52854770/is-there-a-way-of-getting-connectionstatus-from-ivpnprofile-in-a-uwp-application

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