auto internetConnectionProfile = Windows::Networking::Connectivity::NetworkInformation::GetInternetConnectionProfile();
if (internetConnectionProfile == nullptr)
{
return false;
}
else
{
Windows::Networking::Connectivity::NetworkConnectivityLevel level = internetConnectionProfile->GetNetworkConnectivityLevel();
switch (level)
{
case Windows::Networking::Connectivity::NetworkConnectivityLevel::InternetAccess :
{
return true;
}
}
return false;
}
return true;
解决了