Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB4/32,VB5,VB6
Expertise: Intermediate
Aug 7, 2000

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 = 50
Const INTERNET_STATE_DISCONNECTED_BY_USER = &H10

Private Type INTERNET_CONNECTED_INFO
    dwConnectedState As Long
    dwFlags As Long
End Type
Private 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-line

Function 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 If
End Function
Alberto Falossi
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date