PlatformVB

Internet dial functions

The wininet.dll also gives us some dialling functions:

InternetDial

The internet dial function is defined as follows:

Declare Function InternetDial _
      Lib "wininet.dll" Alias "InternetDialA" _
      (ByVal hwndParent As Long, _
      ByVal strEntryName As String, _
      ByVal dwFlags As Long, _
      lpdwConnection As Long, _
      ByVal dwReserved As Long) As Long

If the function succeeds, it returns 0&.  If it fails the return value may be any of the following: ERROR_INVALID_PARAMETER (87), ERROR_NO_CONNECTION (668) or ERROR_USER_DISCONNECTION (631).  The RasErrorHandler function will return a descriptive string for these errors.

Parameters:

hwndParent
The hwnd of your form.  Can be 0&
strEntryName
the name of a ras entry (dial up networking entry)
dwFlags
long value. Can be the combination of any of the following:
1&          -->    INTERNET_AUTODIAL_FORCE_ONLINE
2&          -->    INTERNET_AUTODIAL_FORCE_UNATTENDED
&H8000   -->    INTERNET_DIAL_UNATTENDED 
lpdwConnection
returns the handle to the connection.  Use this to hangup the connection (RAS compatible)
dwReserved 
must be 0&

 InternetHangUp

The internet hang-up function is defined as follows:

Declare Function InternetHangUp Lib "wininet.dll" _
      (ByVal dwConnection As Long, _
       ByVal dwReserved As Long) As Long

Parameters:

dwConnection
The handle to the connection - use the lpdwConnection value returned from the Internet dial function
dwReserved 
must be 0&

Note: you can also use RasHangUp function with the connection handle returned from the InternetDial function.

 

InternetAutodial

The InternetAutodial function dials the default dial up connection entry. It is defined as follows:

Declare Function InternetAutodial Lib "wininet.dll" _
      (ByVal dwFlags As Long, _
       ByVal hwndParent As Long) As Long

If the function succeeds, it returns 1 (TRUE) else it returns 0 (FALSE).  WARNING: if the user has disabled autodial or has no autodial entry defined, the function may still return 1 even though no connection was established.

Parameters:

dwFlags
long value. Can be the combination of any of the following:
1&          -->    INTERNET_AUTODIAL_FORCE_ONLINE
2&          -->    INTERNET_AUTODIAL_FORCE_UNATTENDED
hwndParent
The hwnd of your form.  Can be 0&

 

InternetAutodial

The InternetAutodialHangup disconnects the autodial connection

Declare Function InternetAutodialHangup Lib "wininet.dll" _
      (ByVal dwReserved As Long) As Long

If the function succeeds, it returns 1 (TRUE) else it returns 0 (FALSE).  

Parameters:

dwReserved 
must be 0&

 

 

See Also: Contents, IntroductionRasDial, RasHangUp, VBRasErrorHandler