Quote:
IsNetworkAlive
The IsNetworkAlive function determines whether or not a local system is connected to a network, and identifies the type of network connection, for example, a LAN, WAN, or both.
Bool IsNetworkAlive(
LPDWORD lpdwFlags
);
Parameters
lpdwFlags
[out] The type of network connection that is available. This parameter can be one of the following values:
NETWORK_ALIVE_LAN
The computer has one or more LAN cards that are active.
NETWORK_ALIVE_WAN
The computer has one or more active RAS connections.
NETWORK_ALIVE_AOL
This flag is only valid in Windows Me/98/95.
Indicates a computer is connected to the America Online (AOL) network.
Return Values
This function returns one of the following values:Return code Description
TRUE A local system is connected to a network.
For information about the type of connection, see the lpdwFlags parameter.
FALSE There is no connection.
For extended error information, call GetLastError.
Remarks
This function can be used by an application to determine whether or not there is network connectivity before proceeding with network operations. A directory service type of application, e-mail client, or Internet browser can adapt to various types of network connectivity. For example, a printing operation can be deferred until a network connection is available.
It may not always be practical for an application to call IsNetworkAlive to determine whether or not a local system is disconnected from a LAN, because IsNetworkAlive can be slow, and it may take too much time for the function to detect that a local system is disconnected. However, IsNetworkAlive can always identify a WAN connectivity at the moment.
Note This function is only available for TCP/IP connections.
Resides in sensapi.dll