This is an addition to my collection of the Windows Inet DLL functions. Shows how to Auto-Dial without the user having to insert usernames and passwords. All Automated!
Simply insert this into a module: Option Explicit
Private Declare Function InternetAutodial Lib "wininet.dll" (ByVal dwFlags As
Long, ByVal hwndParent As Long) As Long
Private Const INTERNET_AUTODIAL_FORCE_ONLINE = 1&
Private Const INTERNET_AUTODIAL_FORCE_UNATTENDED = 2&
Private Const INTERNET_AUTODIAL_FAILIFSECURITYCHECK = 4&
Public Enum AutoDialsFlags
ADF_FORCE_ONLINE = INTERNET_AUTODIAL_FORCE_ONLINE
ADF_FORCE_UNATTENDED = INTERNET_AUTODIAL_FORCE_UNATTENDED
End Enum
Public Function Autodial(hwndParentWindow As Long, lOption As AutoDialsFlags,
Optional bFailIfSecurityCheck As Boolean = True) As Boolean
Dim lFlags As Long, lRetValue As Long
On Error GoTo ErrHandle
If bFailIfSecurityCheck Then lFlags = lOption Or INTERNET_AUTODIAL_FAILIFSECURITYCHECK
lRetValue = InternetAutodial(lFlags, hwndParentWindow)
If lRetValue <> 0 Then Autodial = True Else Autodial = False
ErrHandle:
Exit Function
End Function
then call the function to autodial like this:
Autodial hWnd, ADF_FORCE_UNATTENDED, True
This would be a godsend to those writing download managers etc!
Comments