InternetGetConnectedState function

Note  Using this API is not recommended, use the INetworkListManager::GetConnectivity method instead.
Retrieves the connected state of the local system.


BOOLAPI InternetGetConnectedState(
  LPDWORD lpdwFlags,
  DWORD   dwReserved



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.

Value Meaning
Local system has a valid connection to the Internet, but it might or might not be currently connected.
Local system uses a local area network to connect to the Internet.
Local system uses a modem to connect to the Internet.
No longer used.
Local system is in offline mode.
Local system uses a proxy server to connect to the Internet.
Local system has RAS installed.


This parameter is reserved and must be 0.

Return value

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.


A return value of TRUE from InternetGetConnectedState indicates that at least one connection to the Internet is available. It does not guarantee that a connection to a specific host can be established. Applications should always check for errors returned from API calls that connect to a server. InternetCheckConnection can be called to determine if a connection to a specific destination can be established.

A return value of TRUE indicates that either the modem connection is active, or a LAN connection is active and a proxy is properly configured for the LAN. A return value of FALSE indicates that neither the modem nor the LAN is connected. If FALSE is returned, the INTERNET_CONNECTION_CONFIGURED flag may be set to indicate that autodial is configured to "always dial" but is not currently active. If autodial is not configured, the function returns FALSE.




Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winineti.h (include Wininet.h)
Library Wininet.lib
DLL Wininet.dll

See also

Establishing a Dial-Up Connection to the Internet

WinINet Functions