InternetCheckConnectionA function

[InternetCheckConnection is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use NetworkInformation.GetInternetConnectionProfile or the NLM Interfaces. ]

Allows an application to check if a connection to the Internet can be established.

Syntax

BOOLAPI InternetCheckConnectionA(
  LPCSTR lpszUrl,
  DWORD  dwFlags,
  DWORD  dwReserved
);

Parameters

lpszUrl

Pointer to a null-terminated string that specifies the URL to use to check the connection. This value can be NULL.

dwFlags

Options. FLAG_ICC_FORCE_CONNECTION is the only flag that is currently available. If this flag is set, it forces a connection. A sockets connection is attempted in the following order:

  • If lpszUrl is non-NULL, the host value is extracted from it and used to ping that specific host.
  • If lpszUrl is NULL and there is an entry in the internal server database for the nearest server, the host value is extracted from the entry and used to ping that server.

dwReserved

This parameter is reserved and must be 0.

Return Value

Returns TRUE if a connection is made successfully, or FALSE otherwise. Use GetLastError to retrieve the error code. ERROR_NOT_CONNECTED is returned by GetLastError if a connection cannot be made or if the sockets database is unconditionally offline.

Remarks

InternetCheckConnection is deprecated. InternetCheckConnection does not work in environments that use a web proxy server to access the Internet. Depending on the environment, use NetworkInformation.GetInternetConnectionProfile or the NLM Interfaces to check for Internet access instead.

Note  WinINet does not support server implementations. In addition, it should not be used from a service. For server implementations or services use Microsoft Windows HTTP Services (WinHTTP).
 

Requirements

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

See Also

Enabling Internet Functionality

WinINet Functions