Share via


IsInternetConnected function

The IsInternetConnected function determines whether the current user is connected to the Internet.

Syntax

HRESULT WINAPI IsInternetConnected(void);

Parameters

This function has no parameters.

Return value

If the function succeeds, it returns S_OK or S_FALSE. The return value S_OK indicates that the user is connected to the Internet. The return value S_FALSE indicates that the user is not currently connected to the Internet.

If the function fails, the return value is one of the standard error codes.

Remarks

This API uses NCSI and the Network Location Manager (NLM) to determine a "best guess" regarding the Internet connectivity of the current user. Even if S_OK is returned, there is no guarantee that the user will be able to contact a specific Internet address.

An import library containing the IsInternetConnected function is not included in the Microsoft Windows Software Development Kit (SDK). Applications must use the GetModuleHandle and GetProcAddress functions to retrieve the function pointer from the corresponding DLL and call this function.

Requirements

Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
DLL
Connect.dll