|
-
Dec 9th, 2000, 08:48 AM
#1
Thread Starter
New Member
Is there a good way to detect if a PC is connected via phone or Netwrok without using WININET.DLL?
-
Dec 11th, 2000, 05:52 AM
#2
New Member
Through VB .....
Write this code in a VB Project MODULE.bas
Option Explicit
Public Declare Function InternetGetConnectedState _
Lib "wininet.dll" (ByRef lpSFlags As Long, _
ByVal dwReserved As Long) As Long
Public Const INTERNET_CONNECTION_LAN As Long = &H2
Public Const INTERNET_CONNECTION_MODEM As Long = &H1
Public Function Online() As Boolean
Dim SFlags As Long
'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(INTERNET_CONNECTION_LAN, 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(INTERNET_CONNECTION_MODEM, 0)
'True if the Sflags has a modem connection
ViaModem = SFlags And INTERNET_CONNECTION_MODEM
End Function
NOW WRITE THE FOLLOWING CODE IN FORM HAVING 2 TEXT BOXES & A COMMAND BUTTON
Private Sub Command1_Click()
Text1 = ViaLAN()
Text2 = ViaModem()
Text3 = Online()
End Sub
But there is a bug in this program hope you'll be able to resolve it & get back to me. Atleast I've got you started with it.
BYE
-
Dec 11th, 2000, 04:50 PM
#3
Thread Starter
New Member
Thanks for the code sample. However, I'm trying to determine connection state using something other than WININET.DLL
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
|