Check whether the user is working off-line

Check whether the user is working off-line

Internet Explorer offers the possibility to simulate an Internet connection with the off-line mode. If you want to know if off-line mode is on or off you can use InternetQueryOption API.

Const INTERNET_OPTION_CONNECTED_STATE = 50Const INTERNET_STATE_DISCONNECTED_BY_USER = &H10Private Type INTERNET_CONNECTED_INFO    dwConnectedState As Long    dwFlags As LongEnd TypePrivate Declare Function InternetQueryOption Lib "wininet.dll" Alias _    "InternetQueryOptionA" (ByVal hInternet As Long, ByVal dwOption As Long, _    lpBuffer As INTERNET_CONNECTED_INFO, lpdwBufferLength As Long) As Boolean' Return True if the user is working off-lineFunction IsWorkingOffLine() As Boolean    Dim dwState As Long, dwSize As Long    Dim ci As INTERNET_CONNECTED_INFO    dwState = 0    dwSize = LenB(dwState)    If InternetQueryOption(0&, INTERNET_OPTION_CONNECTED_STATE, ci, dwSize) Then        IsWorkingOffLine = (ci.dwConnectedState And _            INTERNET_STATE_DISCONNECTED_BY_USER)    End IfEnd Function

See also  How to Avoid Money Transfer Scams  

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist