Can anyone tell me how to connect to the internet from Windows NT? The normal 98 code doesn't work
Cheers
Chris
Printable View
Can anyone tell me how to connect to the internet from Windows NT? The normal 98 code doesn't work
Cheers
Chris
Use the following API's to connect, they are in wininet.dll
the code above will automatically dial your default connection if you use the unattended code, but if you use the INTERNET_AUTODIAL_FORCE_ONLINE constant then the standard dialog will appear and will prompt you for connection.Code: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
Public Declare Function InternetGetConnectedState _
Lib "wininet.dll" (ByRef lpSFlags As Long, _
ByVal dwReserved As Long) As Long
Public Const INTERNET_AUTODIAL_FORCE_ONLINE = 1
Public Const INTERNET_AUTODIAL_FORCE_UNATTENDED = 2
'you might have to move this code around a bit...
If InternetAutodial(INTERNET_AUTODIAL_FORCE_ONLINE, 0)
Then
'you are connected
End If
'To automatically start dialling
If InternetAutodial(INTERNET_AUTODIAL_FORCE_UNATTENDED, 0) Then
'You are connected
End If
'To disconnect an automatically dialled connection
If InternetAutodialHangup(0) Then
'you are disconnected
endif
hth
Is there anyway of dialing a specific named connection or changing the default connection to a specific name?
I messed around with this for ages, but because there are so many differences between the API's depending upon which OS you are using, I decided to bin the idea and use the free OCX from catalyst.com (socketwrench). It handles all your dialing "stuff", and is dead easy to use, there are probably others out there, but this one worked for me. If you are really intent on using the API, there is a RAS sample on MSDN I think...
hope this helps.
Try this way:
Public Sub ModemCallWin95_98()
Dim WIN
WIN = Shell("rundll32.exe rnaui.dll,RnaDial " & "Your ISP Name", 1)
End Sub
Public Sub ModemCallWinNT()
Dim NT
NT = Shell("rasphone.exe [-d Your ISP Name]", 1)
End Sub
-Dj4