Come posso aprire la finestra di connessione come quella dell'apertura del browser?
Io ho trovato questo, però c'è un problema:
Option Explicit
Private Declare Function RasEnumConnections Lib "RasApi32.dll" Alias "RasEnumConnectionsA" (lpRasCon As Any, lpcb As Long, lpcConnections As Long) As Long
Private Declare Function RasGetConnectStatus Lib "RasApi32.dll" Alias "RasGetConnectStatusA" (ByVal hRasCon As Long, lpStatus As Any) As Long
Private Const RAS95_MaxEntryName = 256
Private Const RAS95_MaxDeviceType = 16
Private Const RAS95_MaxDeviceName = 32
Private Type RASCONN95
dwSize As Long
hRasCon As Long
szEntryName(RAS95_MaxEntryName) As Byte
szDeviceType(RAS95_MaxDeviceType) As Byte
szDeviceName(RAS95_MaxDeviceName) As Byte
End Type
Private Type RASCONNSTATUS95
dwSize As Long
RasConnState As Long
dwError As Long
szDeviceType(RAS95_MaxDeviceType) As Byte
szDeviceName(RAS95_MaxDeviceName) As Byte
End Type
Private Function IsConnected() As Boolean
Dim TRasCon(255) As RASCONN95
Dim lg As Long
Dim lpcon As Long
Dim RetCDec As Long
Dim Tstatus As RASCONNSTATUS95
TRasCon(0).dwSize = 412
lg = 256 * TRasCon(0).dwSize
RetCDec = RasEnumConnections(TRasCon(0), lg, lpcon)
Tstatus.dwSize = 160
RetCDec = RasGetConnectStatus(TRasCon(0).hRasCon, Tstatus)
If Tstatus.RasConnState = &H2000 Then
IsConnected = True
Else
IsConnected = False
End If
End Function
Private Sub Command1_Click()
Dim x As Long
If IsConnected = True Then
MsgBox "Connessione ad internet attiva", vbExclamation, App.Title
Else
If MsgBox("Connessione ad internet non attiva, desideri attivarla?", vbQuestion + vbYesNo, App.Title) = vbYes Then
x = Shell("RUNDLL32.EXE rnaui.dll,RnaDial " & "Connection Name", vbNormalFocus)
End If
End If
End Sub
Era su un Thread di poco tempo fà.
Il problema è il seguente: per avviare una connessione devo conoscere il nome del provider! Come posso fare per aprire una normale finestra come quella del browser oppure come faccio a trovare il nome del provider predefinito?
Grazie!