Not a Member Yet,
Click here to Register
How do you like the new design?






ID: 358
Viewed: 2255
Added: Aug 19, 2002
Version:
Snippet uploaded by: snippet
Written By: Trigeminal Software
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

------------------------------------------
' Connect
'
' Telling whether or not you are connected
' to the Internet
' (c) 1998-99 Trigeminal Software, Inc. All Rights Reserved
'------------------------------------------

Highlight all by clicking in box
<!---Declaration--->
'Option Compare Text
Option Explicit

Private Const INTERNET_OPEN_TYPE_PRECONFIG = 0
Private Const INTERNET_FLAG_RELOAD = &H80000000
Private Const INTERNET_FLAG_KEEP_CONNECTION = &H400000
Private Const INTERNET_FLAG_NO_CACHE_WRITE = &H4000000

Private Declare Function InternetOpen _
Lib "wininet.dll" Alias "InternetOpenW" _
(ByVal lpszAgent As Long, _
ByVal dwAccessType As Long, _
ByVal lpszProxyName As Long, _
ByVal lpszProxyBypass As Long, _
ByVal dwFlags As Long) As Long

Private Declare Function InternetOpenUrl _
Lib "wininet.dll" Alias "InternetOpenUrlW" _
(ByVal hInet As Long, _
ByVal lpszUrl As Long, _
ByVal lpszHeaders As Long, _
ByVal dwHeadersLength As Long, _
ByVal dwFlags As Long, _
ByVal dwContext As Long) As Long

Private Declare Function InternetCloseHandle _
Lib "wininet.dll" (ByVal hInet As Long) As Long

Highlight All
<!---Code--->
Public Function TestConnection(stSite As String) As Boolean
Dim hInet As Long
Dim hUrl As Long
Dim lFlags As Long
Dim url As Variant

hInet = InternetOpen(StrPtr(App.Title), INTERNET_OPEN_TYPE_PRECONFIG, 0&, 0&, 0&)
If hInet Then
lFlags = INTERNET_FLAG_KEEP_CONNECTION Or _
INTERNET_FLAG_NO_CACHE_WRITE Or _
INTERNET_FLAG_RELOAD
hUrl = InternetOpenUrl(hInet, StrPtr(stSite), 0&, 0, lFlags, 0)
If hUrl Then
TestConnection = True
Call InternetCloseHandle(hUrl)
hUrl = 0
End If
End If
Call InternetCloseHandle(hInet)
hInet = 0
End Function;


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2017 snippetlibrary.com All Rights Reserved. Conditions