Not a Member Yet,
Click here to Register

ID: 353
Viewed: 2956
Added: Aug 19, 2002
Version:
Snippet uploaded by: snippet
Written By: Unknown
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

yet another way to see if you are connected to internet

Highlight all by clicking in box
<!---Declaration--->
none

Highlight All
<!---Code--->
'In a Module..
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long ' Note that if you declare the lpData parameter as string, you must pass it By Value.
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Const HKEY_LOCAL_MACHINE = &H80000002

Public Function IsConnected() As Boolean
Dim lRegKey As Long
Dim bData(3) As Byte

If RegOpenKey(HKEY_LOCAL_MACHINE, "SystemCurrentControlSetServicesRemoteAccess", lRegKey) = 0 Then
'Opened RegKey Successfully..
If RegQueryValueEx(lRegKey, "Remote Connection", 0&, 1&, bData(0), 4) = 0 Then
'Query the Value of "Remote Connection" 1 - Connected, 0 - Not Connected
IsConnected = bData(0)
Else
'Counldn't find the Value, assume no Connection
IsConnected = False
End If
'Close the Registry Key
Call RegCloseKey(lRegKey)
End If
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 - 2024 snippetlibrary.com All Rights Reserved. Conditions
Do NOT follow this link or you will be banned from the site!