////// Retrieves the connected state of the local system /// /// Pointer to a variable that receives the connection description. This parameter may return a valid flag even when the function returns FALSE. This parameter can be one or more of the following values. /// This parameter is reserved and must be 0. ///Returns TRUE if there is an active modem or a LAN Internet connection, or FALSE if there is no Internet connection, or if all possible Internet connections are not currently active. For more information, see the Remarks section. /// When InternetGetConnectedState returns FALSE, the application can call GetLastError to retrieve the error code [DllImport("wininet.dll", EntryPoint = "InternetGetConnectedState")] public extern static bool InternetGetConnectedState(out StateFlags lpdwFlags, int dwReserved); public enum StateFlags : int { ////// Local system uses a modem to connect to the Internet. /// INTERNET_CONNECTION_MODEM = 0x01, ////// Local system uses a local area network to connect to the Internet. /// INTERNET_CONNECTION_LAN = 0x02, ////// Local system uses a proxy server to connect to the Internet. /// INTERNET_CONNECTION_PROXY = 0x04, ////// No longer used. /// INTERNET_CONNECTION_MODEM_BUSY = 0x08, ////// Local system has RAS installed. /// INTERNET_RAS_INSTALLED = 0x10, ////// Local system is in offline mode. /// INTERNET_CONNECTION_OFFLINE = 0x20, ////// Local system has a valid connection to the Internet, but it might or might not be currently connected. /// INTERNET_CONNECTION_CONFIGURED = 0x40 }