|
-
Feb 23rd, 2001, 09:30 AM
#1
Thread Starter
Junior Member
I'm writing an HTML parser... I need my program to be able to check if there is an internet conection before it tries to download any html, how do I do this?
-
Feb 23rd, 2001, 09:46 AM
#2
Addicted Member
Hi
Code:
Private Declare Function InternetAttemptConnect Lib "wininet" (ByVal dwReserved As Long) As Long
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: [email protected]
If InternetAttemptConnect(ByVal 0&) = 0 Then
MsgBox "You can connect to the Internet", vbInformation
Else
MsgBox "You cannot connect to the Internet", vbInformation
End If
End Sub
-
Feb 23rd, 2001, 09:54 AM
#3
Thread Starter
Junior Member
Hi too you too
I'm not sure that's what I'm after... I need to check if the computer is already connected, and if not, prompt the user to connect first
does that code do that? or is it for checking if the computer can connect at all to the internet?
-
Apr 12th, 2001, 01:38 AM
#4
-
Apr 12th, 2001, 03:23 AM
#5
Fanatic Member
Maybe:
Checks for active internet connection
Code:
'Author: Hutchie
'Origin: http://www.vb-world.net/tips/tip467.html
'Purpose: Check If there's an active internet connection
'Version: VB5+
Option Explicit
Private Declare Function InternetGetConnectedState _
Lib "wininet.dll" (ByRef lpSFlags As Long, _
ByVal dwReserved As Long) As Long
Private Const INTERNET_CONNECTION_LAN As Long = &H2
Private Const INTERNET_CONNECTION_MODEM As Long = &H1
Public Function Online() As Boolean
'If you are online it will return True, otherwise False
Online = InternetGetConnectedState(0&, 0&)
End Function
Public Function ViaLAN() As Boolean
Dim SFlags As Long
'return the flags associated with the connection
Call InternetGetConnectedState(SFlags, 0&)
'True If the Sflags has a LAN connection
ViaLAN = SFlags And INTERNET_CONNECTION_LAN
End Function
Public Function ViaModem() As Boolean
Dim SFlags As Long
'return the flags associated with the connection
Call InternetGetConnectedState(SFlags, 0&)
'True If the Sflags has a modem connection
ViaModem = SFlags And INTERNET_CONNECTION_MODEM
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|