Results 1 to 3 of 3

Thread: Internet Connection Detect....

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2001
    Posts
    377

    Question Internet Connection Detect....

    anyone know how to detect if an Internet Connection is still present or has been dropped? Other than seeing if a webpage loads.

    i want to be able to insert a code into the Form Load and have it monitor the net connection and pause my app if connection is lost.

  2. #2
    Frenzied Member McGenius's Avatar
    Join Date
    Jan 2003
    Posts
    1,199
    Here is a quick from allapi.com:
    VB Code:
    1. Private Const FLAG_ICC_FORCE_CONNECTION = &H1
    2. Private Declare Function InternetCheckConnection Lib "wininet.dll" Alias "InternetCheckConnectionA" (ByVal lpszUrl As String, ByVal dwFlags As Long, ByVal dwReserved As Long) As Long
    3. Private Sub Form_Load()
    4.     'KPD-Team 2001
    5.     'URL: [url]http://www.allapi.net/[/url]
    6.     'E-Mail: [email][email protected][/email]
    7.     If InternetCheckConnection("http://www.allapi.net/", FLAG_ICC_FORCE_CONNECTION, 0&) = 0 Then
    8.         MsgBox "Connection to [url]http://www.allapi.net/[/url] failed!", vbInformation
    9.     Else
    10.         MsgBox "Connection to [url]http://www.allapi.net/[/url] succeeded!", vbInformation
    11.     End If
    12. End Sub
    McGenius

  3. #3
    Lively Member da_haCKEr's Avatar
    Join Date
    Oct 2002
    Location
    Paradise Isle of Sri Lanka
    Posts
    116

    Cool Here's another from AllAPI

    VB Code:
    1. Private Declare Function InetIsOffline Lib "url.dll" (ByVal dwFlags As Long) As Long
    2. Private Sub Form_Load()
    3.     'KPD-Team 2001
    4.     'URL: [url]http://www.allapi.net/[/url]
    5.     'E-Mail: [email][email protected][/email]
    6.     'InetIsOffline returns 0 if you're connected
    7.     MsgBox "Are you connected to the internet? " + CStr(CBool(Not (InetIsOffline(0)))), vbInformation
    8. End Sub
    .:JanuZ:.
    .:JanuZ:.XtremeSoft


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width