A
Adrian
Hello, I'm currently converting a program at which needs to be able to
dial and disconnect a specified DUN entry.
The VB6 code is as follows and works fine, showing the dialog box for
username and password etc.:
Private Declare Function InternetHangUp Lib "wininet.dll" (ByVal
dwConnection As Long, ByVal dwReserved As Long) As Long
Private Declare Function InternetDial Lib "wininet.dll" (ByVal hWnd As
Long, ByVal sConnectoid As String, ByVal dwFlags As Long,
lpdwConnection As Long, ByVal dwReserved As Long) As Long
Dim ConnectionNumber As Long
Private Sub cmdDisconnect_Click()
lngresult = InternetHangUp(ConnectionNumber, 0)
End Sub
Private Sub Form_Load()
lngresult = InternetDial(0, "test", 0, ConnectionNumber, 0&)
End Sub
I cannot get it to work in VB.net though:
Public Declare Function InternetDial Lib "wininet.dll" (ByVal hWnd As
Long, ByVal sConnectoid As String, ByVal dwFlags As Long, ByVal
lpdwConnection As Long, ByVal dwReserved As Long) As Long
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim lngresult As Long
Dim ConnectionNumber As Long
lngresult = InternetDial(0, "test", 0, ConnectionNumber, 0&)
There are no errors and the program 'runs' okay, but no dialog box
appears and the lngresult is 30064771159.
Hoping for help before my head explodes! :-(
Many thanks
Adrian
dial and disconnect a specified DUN entry.
The VB6 code is as follows and works fine, showing the dialog box for
username and password etc.:
Private Declare Function InternetHangUp Lib "wininet.dll" (ByVal
dwConnection As Long, ByVal dwReserved As Long) As Long
Private Declare Function InternetDial Lib "wininet.dll" (ByVal hWnd As
Long, ByVal sConnectoid As String, ByVal dwFlags As Long,
lpdwConnection As Long, ByVal dwReserved As Long) As Long
Dim ConnectionNumber As Long
Private Sub cmdDisconnect_Click()
lngresult = InternetHangUp(ConnectionNumber, 0)
End Sub
Private Sub Form_Load()
lngresult = InternetDial(0, "test", 0, ConnectionNumber, 0&)
End Sub
I cannot get it to work in VB.net though:
Public Declare Function InternetDial Lib "wininet.dll" (ByVal hWnd As
Long, ByVal sConnectoid As String, ByVal dwFlags As Long, ByVal
lpdwConnection As Long, ByVal dwReserved As Long) As Long
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim lngresult As Long
Dim ConnectionNumber As Long
lngresult = InternetDial(0, "test", 0, ConnectionNumber, 0&)
There are no errors and the program 'runs' okay, but no dialog box
appears and the lngresult is 30064771159.
Hoping for help before my head explodes! :-(
Many thanks
Adrian