Dial up Networking

RBCC

Member
Joined
May 15, 2007
Messages
5
Programming Experience
1-3
Is there a way to involke dial-up-networking? So I automatically dial a modem? John
 
Public Declare Function InternetAutodial Lib "wininet.dll" _
(ByVal dwFlags As Long, ByVal dwReserved As Long) As Long

'flags for InternetAutodial
Private Const INTERNET_AUTODIAL_FORCE_ONLINE = 1
Private Const INTERNET_AUTODIAL_FORCE_UNATTENDED = 2

InternetAutodial(INTERNET_AUTODIAL_FORCE_UNATTENDED, 0&)
 
Those integers are 32bit (Integer, Int32), not 64bit (Long, Int64)
VB.NET:
Const INTERNET_AUTODIAL_FORCE_ONLINE As Int32 = 1
Const INTERNET_AUTODIAL_FORCE_UNATTENDED As Int32 = 2

Declare Function InternetAutodial Lib "wininet.dll" ( _ 
	 ByVal dwFlags As Int32, _ 
	 ByVal hwndParent As Int32) As Int32
 
It return 1 if success and 0 if fail, so fail could be an indication for modem is not there, you could also do a ping/request upon fail to see if already connected. I don't have a dialup, but that's how I understand the docs.
 
or you could use:

Public Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpdwFlags As Integer, ByVal dwReserved As Integer) As Integer

'FLAGS
'Modem is busy.
Public Const ModemConnectionIsBusy As Integer = &H8S

'Internet connection is currently Offline
Public Const InternetIsOffline As Integer = &H20S

'Internet connection is currently configured
Public Const InternetConnectionIsConfigured As Integer = &H40S

'Internet connection VIA Modem.
Public Const ModemConnection As Integer = &H1S
 
Back
Top