I want to work in peace, and only dial-up when ready for it. To that I use:
x = Shell("rundll32.exe rnaui.dll,RnaDial " & (connection), 1)
But is there any way to know wich connections I have and wich is deafault?
regards,
Kristen
Drastrup
Printable View
I want to work in peace, and only dial-up when ready for it. To that I use:
x = Shell("rundll32.exe rnaui.dll,RnaDial " & (connection), 1)
But is there any way to know wich connections I have and wich is deafault?
regards,
Kristen
Drastrup
Replace the wink smilies with )Code:'PUT THIS CODE IN A FORM WITH 1 COMMAND BUTTON
Private Declare Function InternetAutodial Lib "wininet.dll" _
(ByVal dwFlags As Long, ByVal dwReserved As Long) As Long
Private Declare Function InternetAutodialHangup Lib "wininet.dll" _
(ByVal dwReserved As Long) As Long
Private Declare Function InternetGetConnectedState _
Lib "wininet.dll" (ByRef lpSFlags As Long, _
ByVal dwReserved As Long) As Long
Public Enum InetConnect
AUTO = 1
PROMPT = 2
DCONNECT = 3
End Enum
Public Enum ConType
LAN = 1
MODEM = 2
NONE = 3
ALREADY = 4
End Enum
Private Function Online() As Boolean
'If you are online it will return True, otherwise False
Online = InternetGetConnectedState(0&, 0&)
End Function
Private 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
Private 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
Public Sub ConnectInet(CType As InetConnect)
Select Case CType
Case PROMPT
'To prompt the user to connect to the Net
If InternetAutodial(INTERNET_AUTODIAL_FORCE_ONLINE, 0) Then
'You are Connected
End If
Case AUTO
'To automatically start dialling
If InternetAutodial(INTERNET_AUTODIAL_FORCE_UNATTENDED, 0) Then
'You are connected
End If
Case DCONNECT
'To disconnect an automatically dialled connection
If InternetAutodialHangup(0) Then
'You are disconnected
End If
End Select
End Sub
Private Sub Command1_Click()
If Not Online Then
ConnectInet (AUTO)
End If
ConnectInet (PROMPT)
End Sub
hth
[Edited by crispin on 11-15-2000 at 09:30 AM]