Detecting Captive Network Portals
Read more about How Windows detects a Captive Network Portal.
Applications which want to make use of this information can use the Network List Manager API. There's a get_IsConnectedToInternet method on the INetwork interface and the captive portal flag can be found by looking at the VT_UINTs named NA_InternetConnectivityV4 and NA_InternetConnectivityV6 in the INetwork's property bag. If the flag NLM_INTERNET_CONNECTIVITY_WEBHIJACK is set, then a captive portal was detected.