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

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: