|
-
Nov 24th, 2000, 09:20 PM
#1
Thread Starter
Member
I've been searching around the Internet for ages now.
Never did I saw a working code to check and see if the
End-User has a valid Internet Connection.
Checking Registry, WinInet.dll, Pinging, URL Exists,
DSN Resolves, API, and even useless Winsock Control.
None of these things really worked.
People these days are connected to all types of devices.
Modem, LAN, Proxy, DSL, T1, T2, T3, DS3, OC3
All kinds of speed.
How can Microsoft do this? and not make it public information
on how to determine if a User is Connected?
Anyone who got a REAL WORKING API CALL, DEMO, OR EXAMPLE PROJECT? If you do please give me the URL and I can take
it from there.
Using Visual Studio 6 Enterprise
---------------------------------
Everyone needs help at some point..
This time or another.
-
Nov 25th, 2000, 09:55 AM
#2
Hyperactive Member
How About This...
In a Module This:
Code:
Public Const ERROR_SUCCESS = 0&
Public Const APINULL = 0&
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public ReturnCode As Long
Public Const WM_USER = &H400
Public Const PBM_SETBARCOLOR = 1033
Public Const PBM_SETBKCOLOR = 8193
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal _
hKey As Long) As Long
Declare Function RegOpenKey Lib "advapi32.dll" Alias _
"RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As _
String, phkResult As Long) As Long
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
Public Function ActiveConnection() As Boolean
Dim hKey As Long
Dim lpSubKey As String
Dim phkResult As Long
Dim lpValueName As String
Dim lpReserved As Long
Dim lpType As Long
Dim lpData As Long
Dim lpcbData As Long
ActiveConnection = False
lpSubKey = "System\CurrentControlSet\Services\RemoteAccess"
ReturnCode = RegOpenKey(HKEY_LOCAL_MACHINE, lpSubKey, _
phkResult)
If ReturnCode = ERROR_SUCCESS Then
hKey = phkResult
lpValueName = "Remote Connection"
lpReserved = APINULL
lpType = APINULL
lpData = APINULL
lpcbData = APINULL
ReturnCode = RegQueryValueEx(hKey, lpValueName, _
lpReserved, lpType, ByVal lpData, lpcbData)
lpcbData = Len(lpData)
ReturnCode = RegQueryValueEx(hKey, lpValueName, _
lpReserved, lpType, lpData, lpcbData)
If ReturnCode = ERROR_SUCCESS Then
If lpData = 0 Then
ActiveConnection = False
Else
ActiveConnection = True
End If
End If
RegCloseKey (hKey)
End If
End Function
And For use in a form This:
Code:
Private Sub Command1_Click()
If ActiveConnection = True Then
Call MsgBox("You have an active connection.", vbInformation)
Else
Call MsgBox("You have no active connections.", vbInformation)
End If
End Sub
I have tested only in Modem Standard and With ISDN with no
problems.
Hope this is it..
Saludos...
"Who Dares Wins" - "Quien se Arriesga Gana"
Mail me at: 
-
Nov 25th, 2000, 05:16 PM
#3
Thread Starter
Member
Yea, that works..I know
But if you are using Windows 2000. OOopps! hmmm guess what?
It failed. And that doesn't support LAN, Proxy.
This is so stupid, can't never find a working code.
Using Visual Studio 6 Enterprise
---------------------------------
Everyone needs help at some point..
This time or another.
-
Nov 25th, 2000, 06:09 PM
#4
Hyperactive Member
Visual Basic 6 SP4 on win98se
QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!
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
|