|
-
Jul 29th, 2000, 02:50 AM
#1
Thread Starter
Fanatic Member
I've looked at several examples of how to detect if there is an internet connection present and how to connect via dial-up. But they all have their problems...what i need is to detect if a connection exists (preferable not using winsock) and if there is no connection then bring up the connect dialog...The examples that i've seen ask for the connection name, but i need to do this with out asking the connection name...just bring up the "connect to" dialog box.
Thanx,
D!m
-
Jul 29th, 2000, 10:22 AM
#2
Fanatic Member
I'm sure there is a better way but you could run the dos command route print and see if 0.0.0.0 0.0.0.0 goes someplace.
Kurt Simons
[I know I'm a hack but my clients don't!]
-
Jul 29th, 2000, 02:25 PM
#3
Thread Starter
Fanatic Member
nm about the detecting part, i can always use good ol registry for that. But how about bringing up the connect box? Anyone?
-
Jul 29th, 2000, 03:02 PM
#4
Fanatic Member
I had this in my notes from a week ago
I never used it
---------------------
FORCE CONNECTION
------------------------
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&)
Kurt Simons
[I know I'm a hack but my clients don't!]
-
Jul 29th, 2000, 03:09 PM
#5
Thread Starter
Fanatic Member
no go, doesn't produce any errors and doesn't seem to do anything. Any ideas?
-
Jul 29th, 2000, 03:18 PM
#6
This is about the same code. But it's coming from me, so maybe it will work ;].
Code:
Private Declare Function InternetAutodial Lib "wininet.dll" _
(ByVal dwFlags As Long, ByVal dwReserved As Long) As Long
Private Const INTERNET_AUTODIAL_FORCE_ONLINE = 1
Private Const INTERNET_AUTODIAL_FORCE_UNATTENDED = 2
Private Declare Function InternetAutodialHangup Lib "wininet.dll" _
(ByVal dwReserved As Long) As Long
Private Sub Command1_Click()
'To prompt the user to connect to the Net
If InternetAutodial(INTERNET_AUTODIAL_FORCE_ONLINE, 0) Then
MsgBox "You're Connected!", vbInformation
End If
'To automatically start dialling
If InternetAutodial(INTERNET_AUTODIAL_FORCE_UNATTENDED, 0) Then
MsgBox "You're Connected!", vbInformation
End If
'To disconnect an automatically dialled connection
If InternetAutodialHangup(0) Then
MsgBox "You're Disconnected!", vbInformation
End If
End Sub
-
Jul 29th, 2000, 03:27 PM
#7
Thread Starter
Fanatic Member
It does seem to work...but i think i'm missing something here cause it just seems to check if there is a connection. It pops up 3 msgboxes "You Are Connected" "You Are connected" "You are disconnected"
I did go offline to test it, but same events occur.
Any ideas Matthew?
-
Jul 29th, 2000, 03:37 PM
#8
I do have a code that'll connect you, but only if you know the connections name.
Code:
'Start an internet connection only showing the dialog
Dim X
'connection_name=ISP (Ex: Netzero, Freeinternet)
X = Shell("rundll32.exe rnaui.dll,RnaDial " _
& "connection_name", 1)
'Start an internet connection and click connect
Dim X
'connection_name=ISP (Ex: Netzero, Freeinternet)
X = Shell("rundll32.exe rnaui.dll,RnaDial " & "connection_name", 1)
DoEvents
'You can type in your password before the { below.
SendKeys "{enter}", True
DoEvents
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
|