Judging whether it is connected to the Internet

xiaoxiao2021-03-06  41

I have a big snow today, and time is really fast, I'm going to work, I have to go to work in a few days.

API: InternetGetConnectedState

DeconnectedState Lib "Wininet" (Byval CONNECTIONDESCRIPTION AS INTEGER, BYVAL TMP AS INTEGER) AS Boolean

BConnect = InternetGetConnectedState (0, 0)

I now use my mobile phone dial-up test to check the status correctly. How is the situation connected to the LAN after work?

Try ISDESTINATIONREACHABLE ()

------------

MSDN:

InternetGetConnectedState

Retrieves the Connected State of The Local System.

Bool InternetGetConnectedState

LPDWORD LPDWFLAGS,

DWORD DWRESERVED

);

Parameters

LPDWFLAGS

. THUTER TO A VARIABLE THUEVES The Connection Description. This parameter can be one or more of the folowing value.

Value

Meaning

Internet_Connection_Configured

Local System Has A Valid Connection To The Internet, But IT Might or Might Not Be Currently Connected.

Internet_Connection_LAN

Local System Uses a local area network to connect to the Internet.

Internet_connection_modem

Local System Uses a Modem to Connect to the Internet.

Internet_connection_modem_busy

No longer used.

Internet_Connection_offline

Local system is in offline.

Internet_Connection_Proxy

Local System Uses a proxy server to connect to the Internet.

Internet_RAS_InStalled

Local System Has Ras Installed.

DWRESERVED

. "中]...........

Return Values

Returns True if the is an internet connection, or false Otherwise.

// -----------------------------------

#define internet_connection_modem 0x01

#define internet_connection_lan 0x02

#define internet_connection_proxy 0x04

#define internet_connection_modem_busy 0x08 / * no longer used * /

#define internet_ras_installed 0x10 # define internet_connection_offline 0x20

#define internet_connection_configured 0x40

// -----------------------------------

转载请注明原文地址:https://www.9cbs.com/read-58932.html

New Post(0)