|
-
Jul 30th, 2000, 09:00 PM
#1
Thread Starter
Hyperactive Member
Two Questions:
How do I detect if the user is connected to the internet?
If not, how do I launch the default dial-up connection?
-
Jul 30th, 2000, 09:23 PM
#2
Frenzied Member
Checking internet connection
Code:
'in a module
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
'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
'to check if online, text1 will be true if online
Text1 = Online()
'This was a demo project from vb world.
' It had some problems in the module
' that I fixed up.
-
Jul 30th, 2000, 09:38 PM
#3
Thread Starter
Hyperactive Member
Thanks, now I just need to know how to connect if there isn't already an active connection.
-
Jul 30th, 2000, 09:41 PM
#4
Frenzied Member
Also a tip, Not sure if its what your looking for though
http://www.vbsquare.com/tips/tip168.html
try this, its also a tip, Im not sure if its what you want though.
-
Jul 30th, 2000, 09:49 PM
#5
Thread Starter
Hyperactive Member
That is EXTREMELY close to what I want, the only problem is that it has to have the name of the connection, ie Mine is Olemac, not Freeserve.
Is there any way to detect the name or some alternate way to connect?
-
Jul 30th, 2000, 09:57 PM
#6
Thread Starter
Hyperactive Member
Nevermind, I searched through some forum postings for a while for "connect internet" and found one that had this code in it:
Code:
Const Internet_Autodial_Force_Unattended As Long = 2
Public Declare Function InternetAutodial Lib "wininet.dll" (ByVal dwFlags As
Long, ByVal dwReserved As Long) As Long
Public Declare Function InternetAutodialHangup Lib "wininet.dll" (ByVal
dwReserved As Long) As Long
'Code:
Dim lResult As Long
lResult = InternetAutodial(Internet_Autodial_Force_Unattended, 0&
Thanks for your help regardless.
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
|